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