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 |
|
36 class SVD |
|
37 { |
|
38 friend class Matrix; |
|
39 |
|
40 public: |
|
41 |
537
|
42 enum type |
|
43 { |
|
44 std, |
|
45 economy, |
1542
|
46 sigma_only, |
537
|
47 }; |
|
48 |
1528
|
49 SVD (void) { } |
|
50 |
|
51 |
1529
|
52 SVD (const Matrix& a, type svd_type = SVD::std) { init (a, svd_type); } |
457
|
53 |
1529
|
54 SVD (const Matrix& a, int& info, type svd_type = SVD::std) |
1528
|
55 { |
|
56 info = init (a, svd_type); |
|
57 } |
457
|
58 |
1528
|
59 SVD (const SVD& a) |
|
60 { |
|
61 sigma = a.sigma; |
|
62 left_sm = a.left_sm; |
|
63 right_sm = a.right_sm; |
|
64 } |
457
|
65 |
1528
|
66 SVD& operator = (const SVD& a) |
|
67 { |
|
68 sigma = a.sigma; |
|
69 left_sm = a.left_sm; |
|
70 right_sm = a.right_sm; |
|
71 |
|
72 return *this; |
|
73 } |
|
74 |
|
75 DiagMatrix singular_values (void) const { return sigma; } |
|
76 |
1543
|
77 Matrix left_singular_matrix (void); |
1528
|
78 |
1543
|
79 Matrix right_singular_matrix (void); |
457
|
80 |
|
81 friend ostream& operator << (ostream& os, const SVD& a); |
|
82 |
|
83 private: |
|
84 |
1528
|
85 int init (const Matrix& a, type svd_type = std); |
457
|
86 |
|
87 DiagMatrix sigma; |
|
88 Matrix left_sm; |
|
89 Matrix right_sm; |
|
90 }; |
|
91 |
|
92 #endif |
|
93 |
|
94 /* |
|
95 ;;; Local Variables: *** |
|
96 ;;; mode: C++ *** |
|
97 ;;; page-delimiter: "^/\\*" *** |
|
98 ;;; End: *** |
|
99 */ |