Mercurial > hg > octave-nkf
annotate liboctave/dbleSVD.h @ 14193:72aebe619641 stable rc-3-6-0-0
3.6.0-rc0 release candidate
* configure.ac (AC_INIT): Version is now 3.6.0-rc0.
(OCTAVE_RELEASE_DATE): Now 2012-01-10.
(OCTAVE_API_VERSION_NUMBER): Now 47.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 10 Jan 2012 16:43:41 -0500 |
parents | 72c96de7a403 |
children |
rev | line source |
---|---|
457 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
3 Copyright (C) 1994-2012 John W. Eaton |
457 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
457 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
457 | 20 |
21 */ | |
22 | |
23 #if !defined (octave_SVD_h) | |
24 #define octave_SVD_h 1 | |
25 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
26 #include <iosfwd> |
457 | 27 |
28 #include "dDiagMatrix.h" | |
29 #include "dMatrix.h" | |
30 | |
1880 | 31 class |
6108 | 32 OCTAVE_API |
1880 | 33 SVD |
457 | 34 { |
35 public: | |
36 | |
537 | 37 enum type |
38 { | |
39 std, | |
40 economy, | |
2802 | 41 sigma_only |
537 | 42 }; |
43 | |
10601 | 44 enum driver |
45 { | |
46 GESVD, | |
47 GESDD | |
48 }; | |
49 | |
11498
367bfee35ba0
data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10601
diff
changeset
|
50 SVD (void) : type_computed (), sigma (), left_sm (), right_sm () { } |
1528 | 51 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
52 SVD (const Matrix& a, |
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
53 type svd_type = SVD::std, driver svd_driver = SVD::GESVD) |
11498
367bfee35ba0
data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10601
diff
changeset
|
54 : type_computed (), sigma (), left_sm (), right_sm () |
367bfee35ba0
data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10601
diff
changeset
|
55 { |
367bfee35ba0
data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10601
diff
changeset
|
56 init (a, svd_type, svd_driver); |
367bfee35ba0
data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10601
diff
changeset
|
57 } |
457 | 58 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
59 SVD (const Matrix& a, octave_idx_type& info, |
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
60 type svd_type = SVD::std, driver svd_driver = SVD::GESVD) |
11498
367bfee35ba0
data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10601
diff
changeset
|
61 : type_computed (), sigma (), left_sm (), right_sm () |
1528 | 62 { |
10601 | 63 info = init (a, svd_type, svd_driver); |
1528 | 64 } |
457 | 65 |
1528 | 66 SVD (const SVD& a) |
11498
367bfee35ba0
data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10601
diff
changeset
|
67 : type_computed (a.type_computed), sigma (a.sigma), |
367bfee35ba0
data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10601
diff
changeset
|
68 left_sm (a.left_sm), right_sm (a.right_sm) |
367bfee35ba0
data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10601
diff
changeset
|
69 { } |
457 | 70 |
1528 | 71 SVD& operator = (const SVD& a) |
72 { | |
1880 | 73 if (this != &a) |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
74 { |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
75 type_computed = a.type_computed; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
76 sigma = a.sigma; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
77 left_sm = a.left_sm; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
78 right_sm = a.right_sm; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
79 } |
1528 | 80 |
81 return *this; | |
82 } | |
83 | |
1930 | 84 ~SVD (void) { } |
85 | |
1528 | 86 DiagMatrix singular_values (void) const { return sigma; } |
87 | |
1544 | 88 Matrix left_singular_matrix (void) const; |
1528 | 89 |
1544 | 90 Matrix right_singular_matrix (void) const; |
457 | 91 |
3504 | 92 friend std::ostream& operator << (std::ostream& os, const SVD& a); |
457 | 93 |
94 private: | |
95 | |
1544 | 96 SVD::type type_computed; |
97 | |
457 | 98 DiagMatrix sigma; |
99 Matrix left_sm; | |
100 Matrix right_sm; | |
1880 | 101 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
102 octave_idx_type init (const Matrix& a, |
10601 | 103 type svd_type = std, driver svd_driver = GESVD); |
457 | 104 }; |
105 | |
106 #endif |