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