Mercurial > octave
annotate liboctave/numeric/svd.cc @ 23448:e1c02e7126a9
avoid calling abort if possible; include cstdlib for declaration if needed
* Sparse.cc, DASPK.cc, svd.cc, data-conv.cc, lo-utils.cc:
Throw error instead of calling abort.
* error.cc, lo-ieee.cc: Include cstdlib for abort declaration.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 27 Apr 2017 15:26:32 -0400 |
parents | 092078913d54 |
children | c763214a8260 |
rev | line source |
---|---|
457 | 1 /* |
2 | |
23219
3ac9f9ecfae5
maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents:
23083
diff
changeset
|
3 Copyright (C) 2016-2017 Carnë Draug |
22323
bac0d6f07a3e
maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents:
22322
diff
changeset
|
4 Copyright (C) 1994-2016 John W. Eaton |
457 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22592
diff
changeset
|
9 under the terms of the GNU General Public License as published by |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22592
diff
changeset
|
10 the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22592
diff
changeset
|
11 (at your option) any later version. |
457 | 12 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22592
diff
changeset
|
13 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22592
diff
changeset
|
14 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22592
diff
changeset
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22592
diff
changeset
|
16 GNU General Public License for more details. |
457 | 17 |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
457 | 21 |
22 */ | |
23 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
24 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21273
diff
changeset
|
25 # include "config.h" |
457 | 26 #endif |
27 | |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
28 #include "svd.h" |
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
29 |
21273
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
30 #include <cassert> |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
31 #include <algorithm> |
1631 | 32 |
21273
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
33 #include "CMatrix.h" |
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
34 #include "dDiagMatrix.h" |
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
35 #include "fDiagMatrix.h" |
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
36 #include "dMatrix.h" |
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
37 #include "fCMatrix.h" |
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
38 #include "fMatrix.h" |
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
39 #include "lo-error.h" |
22322
93b3cdd36854
move most f77 function decls to separate header files
John W. Eaton <jwe@octave.org>
parents:
22317
diff
changeset
|
40 #include "lo-lapack-proto.h" |
10601 | 41 #include "oct-locbuf.h" |
457 | 42 |
22317
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
22297
diff
changeset
|
43 namespace octave |
6ca3acf5fad8
move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents:
22297
diff
changeset
|
44 { |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
45 namespace math |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
46 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
47 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
48 T |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
49 svd<T>::left_singular_matrix (void) const |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
50 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
51 if (m_type == svd::Type::sigma_only) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
52 (*current_liboctave_error_handler) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
53 ("svd: U not computed because type == svd::sigma_only"); |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
54 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
55 return left_sm; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
56 } |
1543 | 57 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
58 template <typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
59 T |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
60 svd<T>::right_singular_matrix (void) const |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
61 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
62 if (m_type == svd::Type::sigma_only) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
63 (*current_liboctave_error_handler) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
64 ("svd: V not computed because type == svd::sigma_only"); |
21136
7cac4e7458f2
maint: clean up code around calls to current_liboctave_error_handler.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
65 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
66 return right_sm; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
67 } |
1543 | 68 |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
69 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
70 // GESVD specializations |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
71 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
72 #define GESVD_REAL_STEP(f, F) \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
73 F77_XFCN (f, F, (F77_CONST_CHAR_ARG2 (&jobu, 1), \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
74 F77_CONST_CHAR_ARG2 (&jobv, 1), \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
75 m, n, tmp_data, m1, s_vec, u, m1, vt, \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
76 nrow_vt1, work.data (), lwork, info \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
77 F77_CHAR_ARG_LEN (1) \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
78 F77_CHAR_ARG_LEN (1))) |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
79 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
80 #define GESVD_COMPLEX_STEP(f, F, CMPLX_ARG) \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
81 F77_XFCN (f, F, (F77_CONST_CHAR_ARG2 (&jobu, 1), \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
82 F77_CONST_CHAR_ARG2 (&jobv, 1), \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
83 m, n, CMPLX_ARG (tmp_data), \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
84 m1, s_vec, CMPLX_ARG (u), m1, \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
85 CMPLX_ARG (vt), nrow_vt1, \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
86 CMPLX_ARG (work.data ()), \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
87 lwork, rwork.data (), info \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
88 F77_CHAR_ARG_LEN (1) \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
89 F77_CHAR_ARG_LEN (1))) |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
90 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
91 // DGESVD |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
92 template<> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
93 void |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
94 svd<Matrix>::gesvd (char& jobu, char& jobv, F77_INT m, F77_INT n, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
95 double* tmp_data, F77_INT m1, double* s_vec, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
96 double* u, double* vt, F77_INT nrow_vt1, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
97 std::vector<double>& work, F77_INT& lwork, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
98 F77_INT& info) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
99 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
100 GESVD_REAL_STEP (dgesvd, DGESVD); |
21273
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
101 |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
102 lwork = static_cast<F77_INT> (work[0]); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
103 work.reserve (lwork); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
104 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
105 GESVD_REAL_STEP (dgesvd, DGESVD); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
106 } |
21273
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
107 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
108 // SGESVD |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
109 template<> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
110 void |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
111 svd<FloatMatrix>::gesvd (char& jobu, char& jobv, F77_INT m, F77_INT n, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
112 float* tmp_data, F77_INT m1, float* s_vec, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
113 float* u, float* vt, F77_INT nrow_vt1, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
114 std::vector<float>& work, F77_INT& lwork, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
115 F77_INT& info) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
116 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
117 GESVD_REAL_STEP (sgesvd, SGESVD); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
118 |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
119 lwork = static_cast<F77_INT> (work[0]); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
120 work.reserve (lwork); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
121 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
122 GESVD_REAL_STEP (sgesvd, SGESVD); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
123 } |
21273
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
124 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
125 // ZGESVD |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
126 template<> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
127 void |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
128 svd<ComplexMatrix>::gesvd (char& jobu, char& jobv, F77_INT m, F77_INT n, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
129 Complex* tmp_data, F77_INT m1, double* s_vec, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
130 Complex* u, Complex* vt, F77_INT nrow_vt1, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
131 std::vector<Complex>& work, F77_INT& lwork, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
132 F77_INT& info) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
133 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
134 std::vector<double> rwork (5 * std::max (m, n)); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
135 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
136 GESVD_COMPLEX_STEP (zgesvd, ZGESVD, F77_DBLE_CMPLX_ARG); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
137 |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
138 lwork = static_cast<F77_INT> (work[0].real ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
139 work.reserve (lwork); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
140 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
141 GESVD_COMPLEX_STEP (zgesvd, ZGESVD, F77_DBLE_CMPLX_ARG); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
142 } |
21273
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
143 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
144 // CGESVD |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
145 template<> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
146 void |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
147 svd<FloatComplexMatrix>::gesvd (char& jobu, char& jobv, F77_INT m, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
148 F77_INT n, FloatComplex* tmp_data, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
149 F77_INT m1, float* s_vec, FloatComplex* u, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
150 FloatComplex* vt, F77_INT nrow_vt1, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
151 std::vector<FloatComplex>& work, |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
152 F77_INT& lwork, F77_INT& info) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
153 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
154 std::vector<float> rwork (5 * std::max (m, n)); |
21273
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
155 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
156 GESVD_COMPLEX_STEP (cgesvd, CGESVD, F77_CMPLX_ARG); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
157 |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
158 lwork = static_cast<F77_INT> (work[0].real ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
159 work.reserve (lwork); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
160 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
161 GESVD_COMPLEX_STEP (cgesvd, CGESVD, F77_CMPLX_ARG); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
162 } |
21273
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
163 |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
164 #undef GESVD_REAL_STEP |
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
165 #undef GESVD_COMPLEX_STEP |
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
166 |
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
167 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
168 // GESDD specializations |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
169 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
170 #define GESDD_REAL_STEP(f, F) \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
171 F77_XFCN (f, F, (F77_CONST_CHAR_ARG2 (&jobz, 1), \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
172 m, n, tmp_data, m1, s_vec, u, m1, vt, nrow_vt1, \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
173 work.data (), lwork, iwork, info \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
174 F77_CHAR_ARG_LEN (1))) |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
175 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
176 #define GESDD_COMPLEX_STEP(f, F, CMPLX_ARG) \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
177 F77_XFCN (f, F, (F77_CONST_CHAR_ARG2 (&jobz, 1), m, n, \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
178 CMPLX_ARG (tmp_data), m1, \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
179 s_vec, CMPLX_ARG (u), m1, \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
180 CMPLX_ARG (vt), nrow_vt1, \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
181 CMPLX_ARG (work.data ()), lwork, \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
182 rwork.data (), iwork, info \ |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
183 F77_CHAR_ARG_LEN (1))) |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
184 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
185 // DGESDD |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
186 template<> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
187 void |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
188 svd<Matrix>::gesdd (char& jobz, F77_INT m, F77_INT n, double* tmp_data, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
189 F77_INT m1, double* s_vec, double* u, double* vt, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
190 F77_INT nrow_vt1, std::vector<double>& work, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
191 F77_INT& lwork, F77_INT* iwork, F77_INT& info) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
192 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
193 GESDD_REAL_STEP (dgesdd, DGESDD); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
194 |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
195 lwork = static_cast<F77_INT> (work[0]); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
196 work.reserve (lwork); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
197 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
198 GESDD_REAL_STEP (dgesdd, DGESDD); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
199 } |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
200 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
201 // SGESDD |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
202 template<> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
203 void |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
204 svd<FloatMatrix>::gesdd (char& jobz, F77_INT m, F77_INT n, float* tmp_data, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
205 F77_INT m1, float* s_vec, float* u, float* vt, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
206 F77_INT nrow_vt1, std::vector<float>& work, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
207 F77_INT& lwork, F77_INT* iwork, F77_INT& info) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
208 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
209 GESDD_REAL_STEP (sgesdd, SGESDD); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
210 |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
211 lwork = static_cast<F77_INT> (work[0]); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
212 work.reserve (lwork); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
213 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
214 GESDD_REAL_STEP (sgesdd, SGESDD); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
215 } |
21273
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
216 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
217 // ZGESDD |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
218 template<> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
219 void |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
220 svd<ComplexMatrix>::gesdd (char& jobz, F77_INT m, F77_INT n, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
221 Complex* tmp_data, F77_INT m1, double* s_vec, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
222 Complex* u, Complex* vt, F77_INT nrow_vt1, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
223 std::vector<Complex>& work, F77_INT& lwork, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
224 F77_INT* iwork, F77_INT& info) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
225 { |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
226 |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
227 F77_INT min_mn = std::min (m, n); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
228 |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
229 F77_INT lrwork; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
230 if (jobz == 'N') |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
231 lrwork = 7*min_mn; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
232 else |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
233 lrwork = 5*min_mn*min_mn + 5*min_mn; |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
234 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
235 std::vector<double> rwork (lrwork); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
236 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
237 GESDD_COMPLEX_STEP (zgesdd, ZGESDD, F77_DBLE_CMPLX_ARG); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
238 |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
239 lwork = static_cast<F77_INT> (work[0].real ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
240 work.reserve (lwork); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
241 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
242 GESDD_COMPLEX_STEP (zgesdd, ZGESDD, F77_DBLE_CMPLX_ARG); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
243 } |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
244 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
245 // CGESDD |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
246 template<> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
247 void |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
248 svd<FloatComplexMatrix>::gesdd (char& jobz, F77_INT m, F77_INT n, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
249 FloatComplex* tmp_data, F77_INT m1, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
250 float* s_vec, FloatComplex* u, |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
251 FloatComplex* vt, F77_INT nrow_vt1, |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
252 std::vector<FloatComplex>& work, |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
253 F77_INT& lwork, F77_INT* iwork, |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
254 F77_INT& info) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
255 { |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
256 F77_INT min_mn = std::min (m, n); |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
257 F77_INT max_mn = std::max (m, n); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
258 |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
259 F77_INT lrwork; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
260 if (jobz == 'N') |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
261 lrwork = 5*min_mn; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
262 else |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
263 lrwork = min_mn * std::max (5*min_mn+7, 2*max_mn+2*min_mn+1); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
264 std::vector<float> rwork (lrwork); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
265 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
266 GESDD_COMPLEX_STEP (cgesdd, CGESDD, F77_CMPLX_ARG); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
267 |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
268 lwork = static_cast<F77_INT> (work[0].real ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
269 work.reserve (lwork); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
270 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
271 GESDD_COMPLEX_STEP (cgesdd, CGESDD, F77_CMPLX_ARG); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
272 } |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
273 |
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
274 #undef GESDD_REAL_STEP |
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
275 #undef GESDD_COMPLEX_STEP |
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
276 |
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
277 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
278 template<typename T> |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
279 svd<T>::svd (const T& a, svd::Type type, |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
280 svd::Driver driver) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
281 : m_type (type), m_driver (driver), left_sm (), sigma (), right_sm () |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
282 { |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
283 F77_INT info; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
284 |
22988
cd33c785e80e
put to_f77_int inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22944
diff
changeset
|
285 F77_INT m = octave::to_f77_int (a.rows ()); |
cd33c785e80e
put to_f77_int inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
22944
diff
changeset
|
286 F77_INT n = octave::to_f77_int (a.cols ()); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
287 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
288 if (m == 0 || n == 0) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
289 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
290 switch (m_type) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
291 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
292 case svd::Type::std: |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
293 left_sm = T (m, m, 0); |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
294 for (F77_INT i = 0; i < m; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
295 left_sm.xelem (i, i) = 1; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
296 sigma = DM_T (m, n); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
297 right_sm = T (n, n, 0); |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
298 for (F77_INT i = 0; i < n; i++) |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
299 right_sm.xelem (i, i) = 1; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
300 break; |
457 | 301 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
302 case svd::Type::economy: |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
303 left_sm = T (m, 0, 0); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
304 sigma = DM_T (0, 0); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
305 right_sm = T (0, n, 0); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
306 break; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
307 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
308 case svd::Type::sigma_only: |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
309 default: |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
310 sigma = DM_T (0, 1); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
311 break; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
312 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
313 return; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
314 } |
457 | 315 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
316 T atmp = a; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
317 P* tmp_data = atmp.fortran_vec (); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
318 |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
319 F77_INT min_mn = m < n ? m : n; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
320 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
321 char jobu = 'A'; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
322 char jobv = 'A'; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
323 |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
324 F77_INT ncol_u = m; |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
325 F77_INT nrow_vt = n; |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
326 F77_INT nrow_s = m; |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
327 F77_INT ncol_s = n; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
328 |
22228
4afe3705ea75
svd: do not shadow member variables with local variables.
Carnë Draug <carandraug@octave.org>
parents:
22204
diff
changeset
|
329 switch (m_type) |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
330 { |
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
331 case svd::Type::economy: |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
332 jobu = jobv = 'S'; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
333 ncol_u = nrow_vt = nrow_s = ncol_s = min_mn; |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
334 break; |
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
335 |
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
336 case svd::Type::sigma_only: |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
337 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
338 // Note: for this case, both jobu and jobv should be 'N', but |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
339 // there seems to be a bug in dgesvd from Lapack V2.0. To |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
340 // demonstrate the bug, set both jobu and jobv to 'N' and find |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
341 // the singular values of [eye(3), eye(3)]. The result is |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
342 // [-sqrt(2), -sqrt(2), -sqrt(2)]. |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
343 // |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
344 // For Lapack 3.0, this problem seems to be fixed. |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
345 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
346 jobu = jobv = 'N'; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
347 ncol_u = nrow_vt = 1; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
348 break; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
349 |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
350 default: |
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
351 break; |
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
352 } |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
353 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
354 if (! (jobu == 'N' || jobu == 'O')) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
355 left_sm.resize (m, ncol_u); |
22204
469c817eb256
svd: reduce code duplication with more use of template and macro.
Carnë Draug <carandraug@octave.org>
parents:
22135
diff
changeset
|
356 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
357 P* u = left_sm.fortran_vec (); |
457 | 358 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
359 sigma.resize (nrow_s, ncol_s); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
360 DM_P* s_vec = sigma.fortran_vec (); |
457 | 361 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
362 if (! (jobv == 'N' || jobv == 'O')) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
363 right_sm.resize (nrow_vt, n); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
364 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
365 P* vt = right_sm.fortran_vec (); |
537 | 366 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
367 // Query _GESVD for the correct dimension of WORK. |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
368 |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
369 F77_INT lwork = -1; |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
370 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
371 std::vector<P> work (1); |
537 | 372 |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
373 F77_INT m1 = std::max (m, static_cast<F77_INT> (1)); |
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
374 F77_INT nrow_vt1 = std::max (nrow_vt, static_cast<F77_INT> (1)); |
21273
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
375 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
376 if (m_driver == svd::Driver::GESVD) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
377 gesvd (jobu, jobv, m, n, tmp_data, m1, s_vec, u, vt, nrow_vt1, |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
378 work, lwork, info); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
379 else if (m_driver == svd::Driver::GESDD) |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
380 { |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
381 assert (jobu == jobv); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
382 char jobz = jobu; |
21273
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
383 |
22944
5126040e8f49
use F77_INT instead of octave_idx_type for liboctave svd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
384 std::vector<F77_INT> iwork (8 * std::min (m, n)); |
21273
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
385 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
386 gesdd (jobz, m, n, tmp_data, m1, s_vec, u, vt, nrow_vt1, |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
387 work, lwork, iwork.data (), info); |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
388 } |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
389 else |
23448
e1c02e7126a9
avoid calling abort if possible; include cstdlib for declaration if needed
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
390 (*current_liboctave_error_handler) ("svd: unknown driver"); |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
391 |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
392 if (! (jobv == 'N' || jobv == 'O')) |
22592
ee0df00e12d6
fix complex svd (bug #49232)
John W. Eaton <jwe@octave.org>
parents:
22402
diff
changeset
|
393 right_sm = right_sm.hermitian (); |
21273
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
394 } |
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
395 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
396 // Instantiations we need. |
21273
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
397 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
398 template class svd<Matrix>; |
21273
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
399 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
400 template class svd<FloatMatrix>; |
21273
cbced1c09916
better use of templates for svd classes
John W. Eaton <jwe@octave.org>
parents:
21202
diff
changeset
|
401 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
402 template class svd<ComplexMatrix>; |
3336 | 403 |
22329
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
404 template class svd<FloatComplexMatrix>; |
7f3c7a8bd131
maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents:
22323
diff
changeset
|
405 } |
457 | 406 } |