GNU Octave  6.2.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-2021 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 
31 namespace octave
32 {
33  namespace math
34  {
35  template <typename T>
36  class
37  gsvd
38  {
39  public:
40 
41  enum class Type
42  {
43  std,
44  economy,
45  sigma_only
46  };
47 
48  gsvd (void) : sigmaA (), sigmaB (), left_smA (), left_smB (), right_sm ()
49  { }
50 
51  gsvd (const T& a, const T& b,
53 
54  gsvd (const gsvd& a)
55  : type (a.type),
56  sigmaA (a.sigmaA), sigmaB (a.sigmaB),
57  left_smA (a.left_smA), left_smB (a.left_smB), right_sm (a.right_sm),
58  R(a.R) { }
59 
60  gsvd& operator = (const gsvd& a)
61  {
62  if (this != &a)
63  {
64  type = a.type;
65  sigmaA = a.sigmaA;
66  sigmaB = a.sigmaB;
67  left_smA = a.left_smA;
68  left_smB = a.left_smB;
69  right_sm = a.right_sm;
70  R = a.R;
71  }
72 
73  return *this;
74  }
75 
76  ~gsvd (void) = default;
77 
78  typename T::real_diag_matrix_type
79  singular_values_A (void) const { return sigmaA; }
80 
81  typename T::real_diag_matrix_type
82  singular_values_B (void) const { return 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  T R_matrix (void) const;
89 
90  private:
91  typedef typename T::value_type P;
92  typedef typename T::real_matrix_type real_matrix;
93 
95  typename T::real_diag_matrix_type sigmaA, sigmaB;
96  T left_smA, left_smB;
97  T right_sm, R;
98 
99  void ggsvd (char& jobu, char& jobv, char& jobq, octave_f77_int_type m,
100  octave_f77_int_type n, octave_f77_int_type p,
101  octave_f77_int_type& k, octave_f77_int_type& l,
102  P *tmp_dataA, octave_f77_int_type m1,
103  P *tmp_dataB, octave_f77_int_type p1,
104  real_matrix& alpha, real_matrix& beta,
105  P *u, octave_f77_int_type nrow_u,
106  P *v, octave_f77_int_type nrow_v,
107  P *q, octave_f77_int_type nrow_q,
108  T& work, octave_f77_int_type lwork,
109  octave_f77_int_type *iwork,
110  octave_f77_int_type& info);
111  };
112  }
113 }
114 
115 #endif
gsvd(const gsvd &a)
Definition: gsvd.h:54
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, T &work, octave_f77_int_type lwork, octave_f77_int_type *iwork, octave_f77_int_type &info)
gsvd::Type type
Definition: gsvd.h:94
T::real_matrix_type real_matrix
Definition: gsvd.h:92
T::value_type P
Definition: gsvd.h:91
T::real_diag_matrix_type sigmaB
Definition: gsvd.h:95
T::real_diag_matrix_type singular_values_A(void) const
Definition: gsvd.h:79
T::real_diag_matrix_type singular_values_B(void) const
Definition: gsvd.h:82
gsvd(void)
Definition: gsvd.h:48
T::real_diag_matrix_type sigmaA
Definition: gsvd.h:95
~gsvd(void)=default
static octave::math::gsvd< T >::Type gsvd_type(int nargout)
Definition: gsvd.cc:46
T octave_idx_type m
Definition: mx-inlines.cc:773
octave_idx_type n
Definition: mx-inlines.cc:753