GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
gsvd.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1997-2023 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_gsvd_h)
27 #define octave_gsvd_h 1
28 
29 #include "octave-config.h"
30 
32 
34 
35 template <typename T>
36 class
38 gsvd
39 {
40 public:
41 
42  enum class Type
43  {
44  std,
45  economy,
46  sigma_only
47  };
48 
49  gsvd (void) : m_sigmaA (), m_sigmaB (), m_left_smA (), m_left_smB (), m_right_sm ()
50  { }
51 
52  gsvd (const T& a, const T& b,
54 
55  gsvd (const gsvd& a)
56  : m_type (a.m_type),
57  m_sigmaA (a.m_sigmaA), m_sigmaB (a.m_sigmaB),
58  m_left_smA (a.m_left_smA), m_left_smB (a.m_left_smB), m_right_sm (a.m_right_sm)
59  { }
60 
61  gsvd& operator = (const gsvd& a)
62  {
63  if (this != &a)
64  {
65  m_type = a.m_type;
66  m_sigmaA = a.m_sigmaA;
67  m_sigmaB = a.m_sigmaB;
68  m_left_smA = a.m_left_smA;
69  m_left_smB = a.m_left_smB;
70  m_right_sm = a.m_right_sm;
71  }
72 
73  return *this;
74  }
75 
76  ~gsvd (void) = default;
77 
78  typename T::real_matrix_type
79  singular_values_A (void) const { return m_sigmaA; }
80 
81  typename T::real_matrix_type
82  singular_values_B (void) const { return m_sigmaB; }
83 
84  T left_singular_matrix_A (void) const;
85  T left_singular_matrix_B (void) const;
86 
87  T right_singular_matrix (void) const;
88 
89 private:
90  typedef typename T::value_type P;
91  typedef typename T::real_matrix_type real_matrix;
92 
93  void ggsvd (char& jobu, char& jobv, char& jobq, octave_f77_int_type m,
94  octave_f77_int_type n, octave_f77_int_type p,
95  octave_f77_int_type& k, octave_f77_int_type& l,
96  P *tmp_dataA, octave_f77_int_type m1,
97  P *tmp_dataB, octave_f77_int_type p1,
98  real_matrix& alpha, real_matrix& beta,
99  P *u, octave_f77_int_type nrow_u,
100  P *v, octave_f77_int_type nrow_v,
101  P *q, octave_f77_int_type nrow_q,
102  P *work, octave_f77_int_type lwork,
103  octave_f77_int_type *iwork,
104  octave_f77_int_type& info);
105 
106  //--------
107 
110  T m_left_smA, m_left_smB;
112 };
113 
116 
117 #endif
OCTAVE_END_NAMESPACE(octave)
Definition: gsvd.h:39
real_matrix m_sigmaA
Definition: gsvd.h:109
T m_right_sm
Definition: gsvd.h:111
T::value_type P
Definition: gsvd.h:90
real_matrix m_sigmaB
Definition: gsvd.h:109
void ggsvd(char &jobu, char &jobv, char &jobq, octave_f77_int_type m, octave_f77_int_type n, octave_f77_int_type p, octave_f77_int_type &k, octave_f77_int_type &l, P *tmp_dataA, octave_f77_int_type m1, P *tmp_dataB, octave_f77_int_type p1, real_matrix &alpha, real_matrix &beta, P *u, octave_f77_int_type nrow_u, P *v, octave_f77_int_type nrow_v, P *q, octave_f77_int_type nrow_q, P *work, octave_f77_int_type lwork, octave_f77_int_type *iwork, octave_f77_int_type &info)
T::real_matrix_type real_matrix
Definition: gsvd.h:91
gsvd(const gsvd &a)
Definition: gsvd.h:55
T::real_matrix_type singular_values_A(void) const
Definition: gsvd.h:79
~gsvd(void)=default
gsvd(void)
Definition: gsvd.h:49
T::real_matrix_type singular_values_B(void) const
Definition: gsvd.h:82
Type
Definition: gsvd.h:43
gsvd::Type m_type
Definition: gsvd.h:108
T m_left_smA
Definition: gsvd.h:110
T m_left_smB
Definition: gsvd.h:110
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
static math::gsvd< T >::Type gsvd_type(int nargout, int nargin)
Definition: gsvd.cc:47
#define OCTAVE_API
Definition: main.in.cc:55
T octave_idx_type m
Definition: mx-inlines.cc:773
octave_idx_type n
Definition: mx-inlines.cc:753