458
|
1 /* |
|
2 |
1882
|
3 Copyright (C) 1996 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 |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
458
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_DiagMatrix_h) |
|
24 #define octave_DiagMatrix_h 1 |
|
25 |
1296
|
26 #if defined (__GNUG__) |
|
27 #pragma interface |
|
28 #endif |
|
29 |
1989
|
30 #include "MDiagArray2.h" |
458
|
31 |
|
32 #include "dRowVector.h" |
|
33 #include "dColVector.h" |
|
34 |
|
35 #include "mx-defs.h" |
|
36 |
1989
|
37 class DiagMatrix : public MDiagArray2<double> |
458
|
38 { |
|
39 friend class SVD; |
|
40 friend class ComplexSVD; |
|
41 |
|
42 public: |
|
43 |
1989
|
44 DiagMatrix (void) : MDiagArray2<double> () { } |
|
45 DiagMatrix (int r, int c) : MDiagArray2<double> (r, c) { } |
|
46 DiagMatrix (int r, int c, double val) : MDiagArray2<double> (r, c, val) { } |
|
47 DiagMatrix (const RowVector& a) : MDiagArray2<double> (a) { } |
|
48 DiagMatrix (const ColumnVector& a) : MDiagArray2<double> (a) { } |
|
49 DiagMatrix (const MDiagArray2<double>& a) : MDiagArray2<double> (a) { } |
|
50 DiagMatrix (const DiagMatrix& a) : MDiagArray2<double> (a) { } |
458
|
51 |
|
52 DiagMatrix& operator = (const DiagMatrix& a) |
|
53 { |
1989
|
54 MDiagArray2<double>::operator = (a); |
458
|
55 return *this; |
|
56 } |
|
57 |
|
58 int operator == (const DiagMatrix& a) const; |
|
59 int operator != (const DiagMatrix& a) const; |
|
60 |
|
61 DiagMatrix& fill (double val); |
|
62 DiagMatrix& fill (double val, int beg, int end); |
|
63 DiagMatrix& fill (const ColumnVector& a); |
|
64 DiagMatrix& fill (const RowVector& a); |
|
65 DiagMatrix& fill (const ColumnVector& a, int beg); |
|
66 DiagMatrix& fill (const RowVector& a, int beg); |
|
67 |
|
68 DiagMatrix transpose (void) const; |
|
69 |
1205
|
70 friend DiagMatrix real (const ComplexDiagMatrix& a); |
|
71 friend DiagMatrix imag (const ComplexDiagMatrix& a); |
|
72 |
1359
|
73 // resize is the destructive analog for this one |
458
|
74 |
|
75 Matrix extract (int r1, int c1, int r2, int c2) const; |
|
76 |
1359
|
77 // extract row or column i. |
458
|
78 |
|
79 RowVector row (int i) const; |
|
80 RowVector row (char *s) const; |
|
81 |
|
82 ColumnVector column (int i) const; |
|
83 ColumnVector column (char *s) const; |
|
84 |
|
85 DiagMatrix inverse (void) const; |
|
86 DiagMatrix inverse (int& info) const; |
|
87 |
1359
|
88 // diagonal matrix by diagonal matrix -> diagonal matrix operations |
458
|
89 |
|
90 DiagMatrix& operator += (const DiagMatrix& a); |
|
91 DiagMatrix& operator -= (const DiagMatrix& a); |
|
92 |
1359
|
93 // diagonal matrix by diagonal matrix -> diagonal matrix operations |
458
|
94 |
|
95 friend DiagMatrix operator * (const DiagMatrix& a, |
|
96 const DiagMatrix& b); |
|
97 |
1359
|
98 // other operations |
458
|
99 |
|
100 ColumnVector diag (void) const; |
|
101 ColumnVector diag (int k) const; |
|
102 |
1359
|
103 // i/o |
458
|
104 |
|
105 friend ostream& operator << (ostream& os, const DiagMatrix& a); |
|
106 |
|
107 private: |
|
108 |
1989
|
109 DiagMatrix (double *d, int nr, int nc) : MDiagArray2<double> (d, nr, nc) { } |
458
|
110 }; |
|
111 |
|
112 #endif |
|
113 |
|
114 /* |
|
115 ;;; Local Variables: *** |
|
116 ;;; mode: C++ *** |
|
117 ;;; End: *** |
|
118 */ |