Mercurial > octave
annotate liboctave/numeric/schur.h @ 30073:1e277c6b6626
maint: rename schur member function from "unitary_matrix" to "unitary_schur_matrix"
* schur.h: Rename schur member function from "unitary_matrix" to
"unitary_schur_matrix".
* schur.cc, sqrtm.cc, CMatrix.cc, dMatrix.cc, fCMatrix.cc, fMatrix.cc,
schur.cc: Rename all occurrences of "unitary_matrix".
author | Rik <rik@octave.org> |
---|---|
date | Mon, 30 Aug 2021 09:45:47 -0700 |
parents | ae47678c76e8 |
children | 796f54d4ddbf |
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 // |
29358
0a5b15007766
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
3 // Copyright (C) 1994-2021 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 //////////////////////////////////////////////////////////////////////// |
457 | 25 |
21266
e69eaee28737
make better use of templates for Schur decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
26 #if ! defined (octave_schur_h) |
e69eaee28737
make better use of templates for Schur decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
27 #define octave_schur_h 1 |
457 | 28 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
29 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
30 |
1756 | 31 #include <string> |
32 | |
23475
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
33 // FIXME: Don't really need these for compiling schur.h, but it messes |
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
34 // up compilation in liboctave/array if these are not present. |
21266
e69eaee28737
make better use of templates for Schur decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
35 #include "CMatrix.h" |
23475
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
36 #include "dMatrix.h" |
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
37 #include "fCMatrix.h" |
21266
e69eaee28737
make better use of templates for Schur decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
38 #include "fMatrix.h" |
457 | 39 |
22317
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21274
diff
changeset
|
40 namespace octave |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21274
diff
changeset
|
41 { |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
42 namespace math |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
43 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
44 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
45 class |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
46 schur |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
47 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
48 public: |
457 | 49 |
30073
1e277c6b6626
maint: rename schur member function from "unitary_matrix" to "unitary_schur_matrix"
Rik <rik@octave.org>
parents:
30060
diff
changeset
|
50 schur (void) : m_schur_mat (), m_unitary_schur_mat () { } |
457 | 51 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
52 schur (const T& a, const std::string& ord, bool calc_unitary = true) |
30073
1e277c6b6626
maint: rename schur member function from "unitary_matrix" to "unitary_schur_matrix"
Rik <rik@octave.org>
parents:
30060
diff
changeset
|
53 : m_schur_mat (), m_unitary_schur_mat () |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
54 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
55 init (a, ord, calc_unitary); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
56 } |
21266
e69eaee28737
make better use of templates for Schur decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
57 |
22844
7bb977866f55
use F77_INT instead of octave_idx_type for liboctave schur class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
58 schur (const T& a, const std::string& ord, octave_f77_int_type& info, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
59 bool calc_unitary = true) |
30073
1e277c6b6626
maint: rename schur member function from "unitary_matrix" to "unitary_schur_matrix"
Rik <rik@octave.org>
parents:
30060
diff
changeset
|
60 : m_schur_mat (), m_unitary_schur_mat () |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
61 { |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
62 info = init (a, ord, calc_unitary); |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
63 } |
21266
e69eaee28737
make better use of templates for Schur decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
64 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
65 // This one should really be protected or private but we need it in |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
66 // rsf2csf and I don't see how to make that function a friend of |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
67 // this class. |
30073
1e277c6b6626
maint: rename schur member function from "unitary_matrix" to "unitary_schur_matrix"
Rik <rik@octave.org>
parents:
30060
diff
changeset
|
68 schur (const T& s, const T& u) : m_schur_mat (s), m_unitary_schur_mat (u) |
1e277c6b6626
maint: rename schur member function from "unitary_matrix" to "unitary_schur_matrix"
Rik <rik@octave.org>
parents:
30060
diff
changeset
|
69 { } |
1528 | 70 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
71 schur (const schur& a) |
30073
1e277c6b6626
maint: rename schur member function from "unitary_matrix" to "unitary_schur_matrix"
Rik <rik@octave.org>
parents:
30060
diff
changeset
|
72 : m_schur_mat (a.m_schur_mat), |
1e277c6b6626
maint: rename schur member function from "unitary_matrix" to "unitary_schur_matrix"
Rik <rik@octave.org>
parents:
30060
diff
changeset
|
73 m_unitary_schur_mat (a.m_unitary_schur_mat) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
74 { } |
1929 | 75 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
76 schur& operator = (const schur& a) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
77 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
78 if (this != &a) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
79 { |
30060
ae47678c76e8
maint: use "m_" prefix for member variables in class schur.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
80 m_schur_mat = a.m_schur_mat; |
30073
1e277c6b6626
maint: rename schur member function from "unitary_matrix" to "unitary_schur_matrix"
Rik <rik@octave.org>
parents:
30060
diff
changeset
|
81 m_unitary_schur_mat = a.m_unitary_schur_mat; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
82 } |
457 | 83 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
84 return *this; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
85 } |
457 | 86 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22844
diff
changeset
|
87 ~schur (void) = default; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
88 |
30060
ae47678c76e8
maint: use "m_" prefix for member variables in class schur.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
89 T schur_matrix (void) const { return m_schur_mat; } |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
90 |
30073
1e277c6b6626
maint: rename schur member function from "unitary_matrix" to "unitary_schur_matrix"
Rik <rik@octave.org>
parents:
30060
diff
changeset
|
91 T unitary_schur_matrix (void) const { return m_unitary_schur_mat; } |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
92 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
93 protected: |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
94 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
95 private: |
1881 | 96 |
30060
ae47678c76e8
maint: use "m_" prefix for member variables in class schur.
Rik <rik@octave.org>
parents:
29359
diff
changeset
|
97 T m_schur_mat; |
30073
1e277c6b6626
maint: rename schur member function from "unitary_matrix" to "unitary_schur_matrix"
Rik <rik@octave.org>
parents:
30060
diff
changeset
|
98 T m_unitary_schur_mat; |
457 | 99 |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
100 OCTAVE_API octave_f77_int_type |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
101 init (const T& a, const std::string& ord, bool calc_unitary); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
102 }; |
21266
e69eaee28737
make better use of templates for Schur decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
103 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
104 template <typename RT, typename AT> |
29228
5c14f81e0937
Set API tags in files in liboctave/numeric (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
27923
diff
changeset
|
105 extern OCTAVE_API schur<RT> |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
106 rsf2csf (const AT& s, const AT& u); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
107 } |
22317
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21274
diff
changeset
|
108 } |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
21274
diff
changeset
|
109 |
457 | 110 #endif |