GNU Octave  4.4.1
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) 2016-2018 Barbara Lócsi
4 Copyright (C) 2006 Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
5 Copyright (C) 1996, 1997 John W. Eaton
6 
7 This file is part of Octave.
8 
9 Octave is free software: you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Octave is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Octave; see the file COPYING. If not, see
21 <https://www.gnu.org/licenses/>.
22 
23 */
24 
25 #if ! defined (octave_gsvd_h)
26 #define octave_gsvd_h 1
27 
28 #include "octave-config.h"
29 
30 namespace octave
31 {
32  namespace math
33  {
34  template <typename T>
35  class
36  gsvd
37  {
38  public:
39 
40  enum class Type
41  {
42  std,
43  economy,
44  sigma_only
45  };
46 
47  gsvd (void) : sigmaA (), sigmaB (), left_smA (), left_smB (), right_sm ()
48  { }
49 
50  gsvd (const T& a, const T& b,
52 
53  gsvd (const gsvd& a)
54  : type (a.type),
55  sigmaA (a.sigmaA), sigmaB (a.sigmaB),
56  left_smA (a.left_smA), left_smB (a.left_smB), right_sm (a.right_sm),
57  R(a.R) { }
58 
59  gsvd& operator = (const gsvd& a)
60  {
61  if (this != &a)
62  {
63  type = a.type;
64  sigmaA = a.sigmaA;
65  sigmaB = a.sigmaB;
66  left_smA = a.left_smA;
67  left_smB = a.left_smB;
68  right_sm = a.right_sm;
69  R = a.R;
70  }
71 
72  return *this;
73  }
74 
75  ~gsvd (void) = default;
76 
77  typename T::real_diag_matrix_type
78  singular_values_A (void) const { return sigmaA; }
79 
80  typename T::real_diag_matrix_type
81  singular_values_B (void) const { return sigmaB; }
82 
83  T left_singular_matrix_A (void) const;
84  T left_singular_matrix_B (void) const;
85 
86  T right_singular_matrix (void) const;
87  T R_matrix (void) const;
88 
89  private:
90  typedef typename T::value_type P;
91  typedef typename T::real_matrix_type real_matrix;
92 
94  typename T::real_diag_matrix_type sigmaA, sigmaB;
95  T left_smA, left_smB;
96  T right_sm, R;
97 
98  void ggsvd (char& jobu, char& jobv, char& jobq, octave_f77_int_type m,
99  octave_f77_int_type n, octave_f77_int_type p,
100  octave_f77_int_type& k, octave_f77_int_type& l,
101  P *tmp_dataA, octave_f77_int_type m1,
102  P *tmp_dataB, octave_f77_int_type p1,
103  real_matrix& alpha, real_matrix& beta,
104  P *u, octave_f77_int_type nrow_u,
105  P *v, octave_f77_int_type nrow_v,
106  P *q, octave_f77_int_type nrow_q,
107  T& work, octave_f77_int_type lwork,
108  octave_f77_int_type *iwork,
109  octave_f77_int_type& info);
110  };
111  }
112 }
113 
114 #endif
T::real_diag_matrix_type singular_values_B(void) const
Definition: gsvd.h:81
T::value_type P
Definition: gsvd.h:90
for large enough k
Definition: lu.cc:617
T::real_matrix_type real_matrix
Definition: gsvd.h:91
gsvd(const gsvd &a)
Definition: gsvd.h:53
STL namespace.
u
Definition: lu.cc:138
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:400
gsvd(void)
Definition: gsvd.h:47
static octave::math::gsvd< T >::Type gsvd_type(int nargout)
Definition: gsvd.cc:45
T::real_diag_matrix_type sigmaB
Definition: gsvd.h:94
idx type
Definition: ov.cc:3114
gsvd::Type type
Definition: gsvd.h:93
T::real_diag_matrix_type singular_values_A(void) const
Definition: gsvd.h:78
p
Definition: lu.cc:138
b
Definition: cellfun.cc:400