Mercurial > hg > octave-lyh
annotate liboctave/CDiagMatrix.h @ 8500:aaddb450b9aa
[docs] can not => cannot
author | Brian Gough <bjg@gnu.org> |
---|---|
date | Tue, 13 Jan 2009 00:36:52 -0500 |
parents | e3c9102431a9 |
children | 20dfb885f877 |
rev | line source |
---|---|
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" | |
8371
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
33 #include "DET.h" |
458 | 34 |
35 #include "mx-defs.h" | |
36 | |
3585 | 37 class |
38 ComplexDiagMatrix : public MDiagArray2<Complex> | |
458 | 39 { |
40 public: | |
41 | |
1989 | 42 ComplexDiagMatrix (void) : MDiagArray2<Complex> () { } |
3585 | 43 |
5275 | 44 ComplexDiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2<Complex> (r, c) { } |
3585 | 45 |
5275 | 46 ComplexDiagMatrix (octave_idx_type r, octave_idx_type c, const Complex& val) |
1989 | 47 : MDiagArray2<Complex> (r, c, val) { } |
3585 | 48 |
49 explicit ComplexDiagMatrix (const RowVector& a) | |
1989 | 50 : MDiagArray2<Complex> (ComplexRowVector (a)) { } |
3585 | 51 |
52 explicit ComplexDiagMatrix (const ComplexRowVector& a) | |
53 : MDiagArray2<Complex> (a) { } | |
54 | |
55 explicit ComplexDiagMatrix (const ColumnVector& a) | |
1989 | 56 : MDiagArray2<Complex> (ComplexColumnVector (a)) { } |
3585 | 57 |
58 explicit ComplexDiagMatrix (const ComplexColumnVector& a) | |
1989 | 59 : MDiagArray2<Complex> (a) { } |
3585 | 60 |
61 explicit ComplexDiagMatrix (const DiagMatrix& a); | |
62 | |
1989 | 63 ComplexDiagMatrix (const MDiagArray2<Complex>& a) |
64 : MDiagArray2<Complex> (a) { } | |
3585 | 65 |
66 ComplexDiagMatrix (const ComplexDiagMatrix& a) | |
67 : MDiagArray2<Complex> (a) { } | |
458 | 68 |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
69 template <class U> |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
70 ComplexDiagMatrix (const DiagArray2<U>& a) |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
71 : MDiagArray2<Complex> (a) { } |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
72 |
458 | 73 ComplexDiagMatrix& operator = (const ComplexDiagMatrix& a) |
74 { | |
1989 | 75 MDiagArray2<Complex>::operator = (a); |
458 | 76 return *this; |
77 } | |
78 | |
2386 | 79 bool operator == (const ComplexDiagMatrix& a) const; |
80 bool operator != (const ComplexDiagMatrix& a) const; | |
458 | 81 |
82 ComplexDiagMatrix& fill (double val); | |
83 ComplexDiagMatrix& fill (const Complex& val); | |
5275 | 84 ComplexDiagMatrix& fill (double val, octave_idx_type beg, octave_idx_type end); |
85 ComplexDiagMatrix& fill (const Complex& val, octave_idx_type beg, octave_idx_type end); | |
458 | 86 ComplexDiagMatrix& fill (const ColumnVector& a); |
87 ComplexDiagMatrix& fill (const ComplexColumnVector& a); | |
88 ComplexDiagMatrix& fill (const RowVector& a); | |
89 ComplexDiagMatrix& fill (const ComplexRowVector& a); | |
5275 | 90 ComplexDiagMatrix& fill (const ColumnVector& a, octave_idx_type beg); |
91 ComplexDiagMatrix& fill (const ComplexColumnVector& a, octave_idx_type beg); | |
92 ComplexDiagMatrix& fill (const RowVector& a, octave_idx_type beg); | |
93 ComplexDiagMatrix& fill (const ComplexRowVector& a, octave_idx_type beg); | |
458 | 94 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7620
diff
changeset
|
95 ComplexDiagMatrix hermitian (void) const { return MDiagArray2<Complex>::hermitian (std::conj); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7620
diff
changeset
|
96 ComplexDiagMatrix transpose (void) const { return MDiagArray2<Complex>::transpose(); } |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
97 DiagMatrix abs (void) const; |
458 | 98 |
99 friend ComplexDiagMatrix conj (const ComplexDiagMatrix& a); | |
100 | |
1359 | 101 // resize is the destructive analog for this one |
458 | 102 |
5275 | 103 ComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; |
458 | 104 |
1359 | 105 // extract row or column i |
458 | 106 |
5275 | 107 ComplexRowVector row (octave_idx_type i) const; |
458 | 108 ComplexRowVector row (char *s) const; |
109 | |
5275 | 110 ComplexColumnVector column (octave_idx_type i) const; |
458 | 111 ComplexColumnVector column (char *s) const; |
112 | |
113 ComplexDiagMatrix inverse (int& info) const; | |
114 ComplexDiagMatrix inverse (void) const; | |
115 | |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
116 bool all_elements_are_real (void) const; |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
117 |
1359 | 118 // diagonal matrix by diagonal matrix -> diagonal matrix operations |
458 | 119 |
120 ComplexDiagMatrix& operator += (const DiagMatrix& a); | |
121 ComplexDiagMatrix& operator -= (const DiagMatrix& a); | |
122 | |
1359 | 123 // other operations |
458 | 124 |
8375
e3c9102431a9
fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents:
8371
diff
changeset
|
125 ComplexColumnVector diag (octave_idx_type k = 0) const |
e3c9102431a9
fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents:
8371
diff
changeset
|
126 { return MDiagArray2<Complex>::diag (k); } |
458 | 127 |
8371
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
128 ComplexDET determinant (void) const; |
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
129 double rcond (void) const; |
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
130 |
1359 | 131 // i/o |
458 | 132 |
3504 | 133 friend std::ostream& operator << (std::ostream& os, const ComplexDiagMatrix& a); |
458 | 134 |
135 private: | |
136 | |
5275 | 137 ComplexDiagMatrix (Complex *d, octave_idx_type nr, octave_idx_type nc) |
1989 | 138 : MDiagArray2<Complex> (d, nr, nc) { } |
458 | 139 }; |
140 | |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
141 ComplexDiagMatrix conj (const ComplexDiagMatrix& a); |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
142 |
3504 | 143 // diagonal matrix by diagonal matrix -> diagonal matrix operations |
144 | |
145 ComplexDiagMatrix | |
146 operator * (const ComplexDiagMatrix& a, const ComplexDiagMatrix& b); | |
147 | |
148 ComplexDiagMatrix | |
149 operator * (const ComplexDiagMatrix& a, const DiagMatrix& b); | |
150 | |
151 ComplexDiagMatrix | |
152 operator * (const DiagMatrix& a, const ComplexDiagMatrix& b); | |
153 | |
3580 | 154 MDIAGARRAY2_FORWARD_DEFS (MDiagArray2, ComplexDiagMatrix, Complex) |
155 | |
458 | 156 #endif |
157 | |
158 /* | |
159 ;;; Local Variables: *** | |
160 ;;; mode: C++ *** | |
161 ;;; End: *** | |
162 */ |