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