Mercurial > octave
annotate liboctave/numeric/gsvd.h @ 27923:bd51beb6205e
update formatting of copyright notices
* Use <https://octave.org/copyright/> instead of
<https://octave.org/COPYRIGHT.html/>.
* For consistency with other comments in the Octave sources, use
C++-style comments for copyright blocks in C and C++ files.
* Use delimiters above and below copyright blocks that are appropriate
for the language used in the file.
* Eliminate extra spacing inside copyright blocks.
* lex.ll (looks_like_copyright): Also allow newlines and carriage
returns before the word "Copyright".
* scripts/mk-doc.pl (gethelp): Also skip empty comment lines.
* bp-table.cc, type.m: Adjust tests.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 08 Jan 2020 11:59:41 -0500 |
parents | 1891570abac8 |
children | 5c14f81e0937 0a5b15007766 |
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 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
3 // Copyright (C) 1997-2020 The Octave Project Developers |
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 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
37 gsvd |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
38 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
39 public: |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
40 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
41 enum class Type |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
42 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
43 std, |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
44 economy, |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
45 sigma_only |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
46 }; |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
47 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
48 gsvd (void) : sigmaA (), sigmaB (), left_smA (), left_smB (), right_sm () |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
49 { } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
50 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
51 gsvd (const T& a, const T& b, |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
52 gsvd::Type gsvd_type = gsvd<T>::Type::economy); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
53 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
54 gsvd (const gsvd& a) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
55 : type (a.type), |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
56 sigmaA (a.sigmaA), sigmaB (a.sigmaB), |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
57 left_smA (a.left_smA), left_smB (a.left_smB), right_sm (a.right_sm), |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
58 R(a.R) { } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
59 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
60 gsvd& operator = (const gsvd& a) |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
61 { |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
62 if (this != &a) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
63 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
64 type = a.type; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
65 sigmaA = a.sigmaA; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
66 sigmaB = a.sigmaB; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
67 left_smA = a.left_smA; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
68 left_smB = a.left_smB; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
69 right_sm = a.right_sm; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
70 R = a.R; |
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 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
78 typename T::real_diag_matrix_type |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
79 singular_values_A (void) const { return sigmaA; } |
22436
09005ac7d56c
gsvd<T>: add class template support for FloatMatrix and FloatComplexMatrix.
Carnë Draug <carandraug@octave.org>
parents:
22402
diff
changeset
|
80 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
81 typename T::real_diag_matrix_type |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
82 singular_values_B (void) const { return 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; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
88 T R_matrix (void) const; |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
89 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
90 private: |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
91 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
|
92 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
|
93 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
94 gsvd::Type type; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
95 typename T::real_diag_matrix_type sigmaA, sigmaB; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
96 T left_smA, left_smB; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
97 T right_sm, R; |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
98 |
22945
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
99 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
|
100 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
|
101 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
|
102 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
|
103 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
|
104 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
|
105 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
|
106 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
|
107 P *q, octave_f77_int_type nrow_q, |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
108 T& work, octave_f77_int_type lwork, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
109 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
|
110 octave_f77_int_type& info); |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
111 }; |
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 } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
114 |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
115 #endif |