GNU Octave 11.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
gsvd.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1997-2026 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
33
34template <typename T>
36{
37public:
38
39 enum class Type
40 {
41 std,
42 economy,
43 sigma_only
44 };
45
46 gsvd () : m_sigmaA (), m_sigmaB (), m_left_smA (), m_left_smB (), m_right_sm ()
47 { }
48
49 gsvd (const T& a, const T& b,
50 gsvd::Type gsvd_type = gsvd<T>::Type::std);
51
52 gsvd (const gsvd& a)
53 : m_type (a.m_type),
54 m_sigmaA (a.m_sigmaA), m_sigmaB (a.m_sigmaB),
55 m_left_smA (a.m_left_smA), m_left_smB (a.m_left_smB), m_right_sm (a.m_right_sm)
56 { }
57
58 gsvd& operator = (const gsvd& a)
59 {
60 if (this != &a)
61 {
62 m_type = a.m_type;
63 m_sigmaA = a.m_sigmaA;
64 m_sigmaB = a.m_sigmaB;
65 m_left_smA = a.m_left_smA;
66 m_left_smB = a.m_left_smB;
67 m_right_sm = a.m_right_sm;
68 }
69
70 return *this;
71 }
72
73 ~gsvd () = default;
74
75 typename T::real_matrix_type
76 singular_values_A () const { return m_sigmaA; }
77
78 typename T::real_matrix_type
79 singular_values_B () const { return m_sigmaB; }
80
81 T left_singular_matrix_A () const;
82 T left_singular_matrix_B () const;
83
84 T right_singular_matrix () const;
85
86private:
87 typedef typename T::value_type P;
88 typedef typename T::real_matrix_type real_matrix;
89
90 void ggsvd (char& jobu, char& jobv, char& jobq, octave_f77_int_type m,
91 octave_f77_int_type n, octave_f77_int_type p,
92 octave_f77_int_type& k, octave_f77_int_type& l,
93 P *tmp_dataA, octave_f77_int_type m1,
94 P *tmp_dataB, octave_f77_int_type p1,
95 real_matrix& alpha, real_matrix& beta,
96 P *u, octave_f77_int_type nrow_u,
97 P *v, octave_f77_int_type nrow_v,
98 P *q, octave_f77_int_type nrow_q,
99 P *work, octave_f77_int_type lwork,
100 octave_f77_int_type *iwork,
101 octave_f77_int_type& info);
102
103 //--------
104
105 gsvd::Type m_type;
106 real_matrix m_sigmaA, m_sigmaB;
107 T m_left_smA, m_left_smB;
108 T m_right_sm;
109};
110
111OCTAVE_END_NAMESPACE(math)
112OCTAVE_END_NAMESPACE(octave)
113
114#endif
Definition gsvd.h:36
T::real_matrix_type singular_values_A() const
Definition gsvd.h:76
gsvd(const gsvd &a)
Definition gsvd.h:52
~gsvd()=default
gsvd()
Definition gsvd.h:46
T::real_matrix_type singular_values_B() const
Definition gsvd.h:79
Type
Definition gsvd.h:40
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define OCTAVE_API
Definition main.in.cc:55