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