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 |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
458
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_ComplexDiagMatrix_h) |
|
24 #define octave_ComplexDiagMatrix_h 1 |
|
25 |
4192
|
26 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
1296
|
27 #pragma interface |
|
28 #endif |
|
29 |
1989
|
30 #include "MDiagArray2.h" |
458
|
31 |
|
32 #include "dRowVector.h" |
|
33 #include "CRowVector.h" |
|
34 #include "dColVector.h" |
|
35 #include "CColVector.h" |
|
36 |
|
37 #include "mx-defs.h" |
|
38 |
3585
|
39 class |
|
40 ComplexDiagMatrix : public MDiagArray2<Complex> |
458
|
41 { |
|
42 public: |
|
43 |
1989
|
44 ComplexDiagMatrix (void) : MDiagArray2<Complex> () { } |
3585
|
45 |
1989
|
46 ComplexDiagMatrix (int r, int c) : MDiagArray2<Complex> (r, c) { } |
3585
|
47 |
458
|
48 ComplexDiagMatrix (int r, int c, const Complex& val) |
1989
|
49 : MDiagArray2<Complex> (r, c, val) { } |
3585
|
50 |
|
51 explicit ComplexDiagMatrix (const RowVector& a) |
1989
|
52 : MDiagArray2<Complex> (ComplexRowVector (a)) { } |
3585
|
53 |
|
54 explicit ComplexDiagMatrix (const ComplexRowVector& a) |
|
55 : MDiagArray2<Complex> (a) { } |
|
56 |
|
57 explicit ComplexDiagMatrix (const ColumnVector& a) |
1989
|
58 : MDiagArray2<Complex> (ComplexColumnVector (a)) { } |
3585
|
59 |
|
60 explicit ComplexDiagMatrix (const ComplexColumnVector& a) |
1989
|
61 : MDiagArray2<Complex> (a) { } |
3585
|
62 |
|
63 explicit ComplexDiagMatrix (const DiagMatrix& a); |
|
64 |
1989
|
65 ComplexDiagMatrix (const MDiagArray2<Complex>& a) |
|
66 : MDiagArray2<Complex> (a) { } |
3585
|
67 |
|
68 ComplexDiagMatrix (const ComplexDiagMatrix& a) |
|
69 : MDiagArray2<Complex> (a) { } |
458
|
70 |
|
71 ComplexDiagMatrix& operator = (const ComplexDiagMatrix& a) |
|
72 { |
1989
|
73 MDiagArray2<Complex>::operator = (a); |
458
|
74 return *this; |
|
75 } |
|
76 |
2386
|
77 bool operator == (const ComplexDiagMatrix& a) const; |
|
78 bool operator != (const ComplexDiagMatrix& a) const; |
458
|
79 |
|
80 ComplexDiagMatrix& fill (double val); |
|
81 ComplexDiagMatrix& fill (const Complex& val); |
|
82 ComplexDiagMatrix& fill (double val, int beg, int end); |
|
83 ComplexDiagMatrix& fill (const Complex& val, int beg, int end); |
|
84 ComplexDiagMatrix& fill (const ColumnVector& a); |
|
85 ComplexDiagMatrix& fill (const ComplexColumnVector& a); |
|
86 ComplexDiagMatrix& fill (const RowVector& a); |
|
87 ComplexDiagMatrix& fill (const ComplexRowVector& a); |
|
88 ComplexDiagMatrix& fill (const ColumnVector& a, int beg); |
|
89 ComplexDiagMatrix& fill (const ComplexColumnVector& a, int beg); |
|
90 ComplexDiagMatrix& fill (const RowVector& a, int beg); |
|
91 ComplexDiagMatrix& fill (const ComplexRowVector& a, int beg); |
|
92 |
|
93 ComplexDiagMatrix hermitian (void) const; // complex conjugate transpose |
|
94 ComplexDiagMatrix transpose (void) const; |
|
95 |
|
96 friend ComplexDiagMatrix conj (const ComplexDiagMatrix& a); |
|
97 |
1359
|
98 // resize is the destructive analog for this one |
458
|
99 |
|
100 ComplexMatrix extract (int r1, int c1, int r2, int c2) const; |
|
101 |
1359
|
102 // extract row or column i |
458
|
103 |
|
104 ComplexRowVector row (int i) const; |
|
105 ComplexRowVector row (char *s) const; |
|
106 |
|
107 ComplexColumnVector column (int i) const; |
|
108 ComplexColumnVector column (char *s) const; |
|
109 |
|
110 ComplexDiagMatrix inverse (int& info) const; |
|
111 ComplexDiagMatrix inverse (void) const; |
|
112 |
1359
|
113 // diagonal matrix by diagonal matrix -> diagonal matrix operations |
458
|
114 |
|
115 ComplexDiagMatrix& operator += (const DiagMatrix& a); |
|
116 ComplexDiagMatrix& operator -= (const DiagMatrix& a); |
|
117 |
1359
|
118 // other operations |
458
|
119 |
|
120 ComplexColumnVector diag (void) const; |
|
121 ComplexColumnVector diag (int k) const; |
|
122 |
1359
|
123 // i/o |
458
|
124 |
3504
|
125 friend std::ostream& operator << (std::ostream& os, const ComplexDiagMatrix& a); |
458
|
126 |
|
127 private: |
|
128 |
|
129 ComplexDiagMatrix (Complex *d, int nr, int nc) |
1989
|
130 : MDiagArray2<Complex> (d, nr, nc) { } |
458
|
131 }; |
|
132 |
3504
|
133 // diagonal matrix by diagonal matrix -> diagonal matrix operations |
|
134 |
|
135 ComplexDiagMatrix |
|
136 operator * (const ComplexDiagMatrix& a, const ComplexDiagMatrix& b); |
|
137 |
|
138 ComplexDiagMatrix |
|
139 operator * (const ComplexDiagMatrix& a, const DiagMatrix& b); |
|
140 |
|
141 ComplexDiagMatrix |
|
142 operator * (const DiagMatrix& a, const ComplexDiagMatrix& b); |
|
143 |
3580
|
144 MDIAGARRAY2_FORWARD_DEFS (MDiagArray2, ComplexDiagMatrix, Complex) |
|
145 |
458
|
146 #endif |
|
147 |
|
148 /* |
|
149 ;;; Local Variables: *** |
|
150 ;;; mode: C++ *** |
|
151 ;;; End: *** |
|
152 */ |