458
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
458
|
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 |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
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 |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
458
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_DiagMatrix_h) |
|
25 #define octave_DiagMatrix_h 1 |
|
26 |
1989
|
27 #include "MDiagArray2.h" |
458
|
28 |
|
29 #include "dRowVector.h" |
|
30 #include "dColVector.h" |
|
31 |
|
32 #include "mx-defs.h" |
|
33 |
3585
|
34 class |
6108
|
35 OCTAVE_API |
3585
|
36 DiagMatrix : public MDiagArray2<double> |
458
|
37 { |
|
38 friend class SVD; |
|
39 friend class ComplexSVD; |
|
40 |
|
41 public: |
|
42 |
1989
|
43 DiagMatrix (void) : MDiagArray2<double> () { } |
3585
|
44 |
5275
|
45 DiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2<double> (r, c) { } |
3585
|
46 |
5275
|
47 DiagMatrix (octave_idx_type r, octave_idx_type c, double val) : MDiagArray2<double> (r, c, val) { } |
3585
|
48 |
|
49 DiagMatrix (const DiagMatrix& a) : MDiagArray2<double> (a) { } |
|
50 |
1989
|
51 DiagMatrix (const MDiagArray2<double>& a) : MDiagArray2<double> (a) { } |
3585
|
52 |
|
53 explicit DiagMatrix (const RowVector& a) : MDiagArray2<double> (a) { } |
|
54 |
|
55 explicit DiagMatrix (const ColumnVector& a) : MDiagArray2<double> (a) { } |
458
|
56 |
|
57 DiagMatrix& operator = (const DiagMatrix& a) |
|
58 { |
1989
|
59 MDiagArray2<double>::operator = (a); |
458
|
60 return *this; |
|
61 } |
|
62 |
2385
|
63 bool operator == (const DiagMatrix& a) const; |
|
64 bool operator != (const DiagMatrix& a) const; |
458
|
65 |
|
66 DiagMatrix& fill (double val); |
5275
|
67 DiagMatrix& fill (double val, octave_idx_type beg, octave_idx_type end); |
458
|
68 DiagMatrix& fill (const ColumnVector& a); |
|
69 DiagMatrix& fill (const RowVector& a); |
5275
|
70 DiagMatrix& fill (const ColumnVector& a, octave_idx_type beg); |
|
71 DiagMatrix& fill (const RowVector& a, octave_idx_type beg); |
458
|
72 |
|
73 DiagMatrix transpose (void) const; |
|
74 |
6153
|
75 friend OCTAVE_API DiagMatrix real (const ComplexDiagMatrix& a); |
|
76 friend OCTAVE_API DiagMatrix imag (const ComplexDiagMatrix& a); |
1205
|
77 |
1359
|
78 // resize is the destructive analog for this one |
458
|
79 |
5275
|
80 Matrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; |
458
|
81 |
1359
|
82 // extract row or column i. |
458
|
83 |
5275
|
84 RowVector row (octave_idx_type i) const; |
458
|
85 RowVector row (char *s) const; |
|
86 |
5275
|
87 ColumnVector column (octave_idx_type i) const; |
458
|
88 ColumnVector column (char *s) const; |
|
89 |
|
90 DiagMatrix inverse (void) const; |
|
91 DiagMatrix inverse (int& info) const; |
|
92 |
1359
|
93 // other operations |
458
|
94 |
|
95 ColumnVector diag (void) const; |
5275
|
96 ColumnVector diag (octave_idx_type k) const; |
458
|
97 |
1359
|
98 // i/o |
458
|
99 |
6153
|
100 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const DiagMatrix& a); |
458
|
101 |
|
102 private: |
|
103 |
5275
|
104 DiagMatrix (double *d, octave_idx_type nr, octave_idx_type nc) : MDiagArray2<double> (d, nr, nc) { } |
458
|
105 }; |
|
106 |
3504
|
107 // diagonal matrix by diagonal matrix -> diagonal matrix operations |
|
108 |
|
109 DiagMatrix |
|
110 operator * (const DiagMatrix& a, const DiagMatrix& b); |
|
111 |
3580
|
112 MDIAGARRAY2_FORWARD_DEFS (MDiagArray2, DiagMatrix, double) |
|
113 |
458
|
114 #endif |
|
115 |
|
116 /* |
|
117 ;;; Local Variables: *** |
|
118 ;;; mode: C++ *** |
|
119 ;;; End: *** |
|
120 */ |