annotate liboctave/numeric/gsvd.h @ 30564:796f54d4ddbf stable

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2021. In all .txi and .texi files except gpl.txi and gpl.texi in the doc/liboctave and doc/interpreter directories, change the copyright to "Octave Project Developers", the same as used for other source files. Update copyright notices for 2022 (not done since 2019). For gpl.txi and gpl.texi, change the copyright notice to be "Free Software Foundation, Inc." and leave the date at 2007 only because this file only contains the text of the GPL, not anything created by the Octave Project Developers. Add Paul Thomas to contributors.in.
author John W. Eaton <jwe@octave.org>
date Tue, 28 Dec 2021 18:22:40 -0500
parents 4fa09c269dde
children e88a07dec498
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 30302
diff changeset
3 // Copyright (C) 1997-2022 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
25
22737
7abc25e6206a maint: Clean up code base to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 22437
diff changeset
26 #if ! defined (octave_gsvd_h)
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
27 #define octave_gsvd_h 1
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
28
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
29 #include "octave-config.h"
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
30
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
31 namespace octave
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
32 {
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
33 namespace math
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
34 {
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
35 template <typename T>
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
36 class
29228
5c14f81e0937 Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
37 OCTAVE_API
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
38 gsvd
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
39 {
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
40 public:
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
41
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
42 enum class Type
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
43 {
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
44 std,
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
45 economy,
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
46 sigma_only
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
47 };
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
48
30302
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
49 gsvd (void) : m_sigmaA (), m_sigmaB (), m_left_smA (), m_left_smB (), m_right_sm ()
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
50 { }
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
51
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
52 gsvd (const T& a, const T& b,
30300
4ee01c14fccd Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents: 29359
diff changeset
53 gsvd::Type gsvd_type = gsvd<T>::Type::std);
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
54
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
55 gsvd (const gsvd& a)
30302
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
56 : m_type (a.m_type),
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
57 m_sigmaA (a.m_sigmaA), m_sigmaB (a.m_sigmaB),
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
58 m_left_smA (a.m_left_smA), m_left_smB (a.m_left_smB), m_right_sm (a.m_right_sm)
30300
4ee01c14fccd Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents: 29359
diff changeset
59 { }
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
60
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
61 gsvd& operator = (const gsvd& a)
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22323
diff changeset
62 {
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
63 if (this != &a)
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
64 {
30302
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
65 m_type = a.m_type;
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
66 m_sigmaA = a.m_sigmaA;
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
67 m_sigmaB = a.m_sigmaB;
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
68 m_left_smA = a.m_left_smA;
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
69 m_left_smB = a.m_left_smB;
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
70 m_right_sm = a.m_right_sm;
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
71 }
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
72
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
73 return *this;
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22323
diff changeset
74 }
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
75
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
76 ~gsvd (void) = default;
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
77
30300
4ee01c14fccd Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents: 29359
diff changeset
78 typename T::real_matrix_type
30302
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
79 singular_values_A (void) const { return m_sigmaA; }
22436
09005ac7d56c gsvd<T>: add class template support for FloatMatrix and FloatComplexMatrix.
Carnë Draug <carandraug@octave.org>
parents: 22402
diff changeset
80
30300
4ee01c14fccd Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents: 29359
diff changeset
81 typename T::real_matrix_type
30302
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
82 singular_values_B (void) const { return m_sigmaB; }
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
83
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
84 T left_singular_matrix_A (void) const;
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
85 T left_singular_matrix_B (void) const;
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
86
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
87 T right_singular_matrix (void) const;
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
88
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
89 private:
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
90 typedef typename T::value_type P;
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
91 typedef typename T::real_matrix_type real_matrix;
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
92
22945
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
93 void ggsvd (char& jobu, char& jobv, char& jobq, octave_f77_int_type m,
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
94 octave_f77_int_type n, octave_f77_int_type p,
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
95 octave_f77_int_type& k, octave_f77_int_type& l,
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
96 P *tmp_dataA, octave_f77_int_type m1,
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
97 P *tmp_dataB, octave_f77_int_type p1,
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
98 real_matrix& alpha, real_matrix& beta,
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
99 P *u, octave_f77_int_type nrow_u,
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
100 P *v, octave_f77_int_type nrow_v,
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
101 P *q, octave_f77_int_type nrow_q,
30300
4ee01c14fccd Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents: 29359
diff changeset
102 P *work, octave_f77_int_type lwork,
24653
f0de21a6a426 Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents: 24534
diff changeset
103 octave_f77_int_type *iwork,
22945
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
104 octave_f77_int_type& info);
30302
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
105
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
106 //--------
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
107
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
108 gsvd::Type m_type;
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
109 real_matrix m_sigmaA, m_sigmaB;
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
110 T m_left_smA, m_left_smB;
4fa09c269dde maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents: 30300
diff changeset
111 T m_right_sm;
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
112 };
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
113 }
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
114 }
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
115
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
116 #endif