457
|
1 // -*- C++ -*- |
|
2 /* |
|
3 |
1011
|
4 Copyright (C) 1992, 1993, 1994, 1995 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 |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
457
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_SVD_h) |
|
25 #define octave_SVD_h 1 |
|
26 |
1296
|
27 #if defined (__GNUG__) |
|
28 #pragma interface |
|
29 #endif |
|
30 |
457
|
31 class ostream; |
|
32 |
|
33 #include "dDiagMatrix.h" |
|
34 #include "dMatrix.h" |
|
35 |
1880
|
36 class |
|
37 SVD |
457
|
38 { |
|
39 public: |
|
40 |
537
|
41 enum type |
|
42 { |
|
43 std, |
|
44 economy, |
1542
|
45 sigma_only, |
537
|
46 }; |
|
47 |
1528
|
48 SVD (void) { } |
|
49 |
1529
|
50 SVD (const Matrix& a, type svd_type = SVD::std) { init (a, svd_type); } |
457
|
51 |
1529
|
52 SVD (const Matrix& a, int& info, type svd_type = SVD::std) |
1528
|
53 { |
|
54 info = init (a, svd_type); |
|
55 } |
457
|
56 |
1528
|
57 SVD (const SVD& a) |
|
58 { |
|
59 sigma = a.sigma; |
|
60 left_sm = a.left_sm; |
|
61 right_sm = a.right_sm; |
|
62 } |
457
|
63 |
1528
|
64 SVD& operator = (const SVD& a) |
|
65 { |
1880
|
66 if (this != &a) |
|
67 { |
|
68 sigma = a.sigma; |
|
69 left_sm = a.left_sm; |
|
70 right_sm = a.right_sm; |
|
71 } |
1528
|
72 |
|
73 return *this; |
|
74 } |
|
75 |
|
76 DiagMatrix singular_values (void) const { return sigma; } |
|
77 |
1544
|
78 Matrix left_singular_matrix (void) const; |
1528
|
79 |
1544
|
80 Matrix right_singular_matrix (void) const; |
457
|
81 |
|
82 friend ostream& operator << (ostream& os, const SVD& a); |
|
83 |
|
84 private: |
|
85 |
1544
|
86 SVD::type type_computed; |
|
87 |
457
|
88 DiagMatrix sigma; |
|
89 Matrix left_sm; |
|
90 Matrix right_sm; |
1880
|
91 |
|
92 int init (const Matrix& a, type svd_type = std); |
457
|
93 }; |
|
94 |
|
95 #endif |
|
96 |
|
97 /* |
|
98 ;;; Local Variables: *** |
|
99 ;;; mode: C++ *** |
|
100 ;;; page-delimiter: "^/\\*" *** |
|
101 ;;; End: *** |
|
102 */ |