Mercurial > hg > octave-nkf
annotate liboctave/CDiagMatrix.h @ 9585:06b8b51dca48
also handle user-defined graphics properties in new property name validation scheme
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 28 Aug 2009 18:37:31 -0400 |
parents | 3c1762c7e787 |
children | 4c0cdbe0acca |
rev | line source |
---|---|
458 | 1 /* |
2 | |
8920 | 3 Copyright (C) 1994, 1995, 1996, 1997, 2000, 2002, 2004, 2005, 2007, |
4 2008, 2009 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 |
9237
3c1762c7e787
Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
38 OCTAVE_API |
3585 | 39 ComplexDiagMatrix : public MDiagArray2<Complex> |
458 | 40 { |
41 public: | |
42 | |
1989 | 43 ComplexDiagMatrix (void) : MDiagArray2<Complex> () { } |
3585 | 44 |
5275 | 45 ComplexDiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2<Complex> (r, c) { } |
3585 | 46 |
5275 | 47 ComplexDiagMatrix (octave_idx_type r, octave_idx_type c, const Complex& val) |
1989 | 48 : MDiagArray2<Complex> (r, c, val) { } |
3585 | 49 |
50 explicit ComplexDiagMatrix (const RowVector& a) | |
1989 | 51 : MDiagArray2<Complex> (ComplexRowVector (a)) { } |
3585 | 52 |
53 explicit ComplexDiagMatrix (const ComplexRowVector& a) | |
54 : MDiagArray2<Complex> (a) { } | |
55 | |
56 explicit ComplexDiagMatrix (const ColumnVector& a) | |
1989 | 57 : MDiagArray2<Complex> (ComplexColumnVector (a)) { } |
3585 | 58 |
59 explicit ComplexDiagMatrix (const ComplexColumnVector& a) | |
1989 | 60 : MDiagArray2<Complex> (a) { } |
3585 | 61 |
62 explicit ComplexDiagMatrix (const DiagMatrix& a); | |
63 | |
1989 | 64 ComplexDiagMatrix (const MDiagArray2<Complex>& a) |
65 : MDiagArray2<Complex> (a) { } | |
3585 | 66 |
67 ComplexDiagMatrix (const ComplexDiagMatrix& a) | |
68 : MDiagArray2<Complex> (a) { } | |
458 | 69 |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
70 template <class U> |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
71 ComplexDiagMatrix (const DiagArray2<U>& a) |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
72 : MDiagArray2<Complex> (a) { } |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
73 |
458 | 74 ComplexDiagMatrix& operator = (const ComplexDiagMatrix& a) |
75 { | |
1989 | 76 MDiagArray2<Complex>::operator = (a); |
458 | 77 return *this; |
78 } | |
79 | |
2386 | 80 bool operator == (const ComplexDiagMatrix& a) const; |
81 bool operator != (const ComplexDiagMatrix& a) const; | |
458 | 82 |
83 ComplexDiagMatrix& fill (double val); | |
84 ComplexDiagMatrix& fill (const Complex& val); | |
5275 | 85 ComplexDiagMatrix& fill (double val, octave_idx_type beg, octave_idx_type end); |
86 ComplexDiagMatrix& fill (const Complex& val, octave_idx_type beg, octave_idx_type end); | |
458 | 87 ComplexDiagMatrix& fill (const ColumnVector& a); |
88 ComplexDiagMatrix& fill (const ComplexColumnVector& a); | |
89 ComplexDiagMatrix& fill (const RowVector& a); | |
90 ComplexDiagMatrix& fill (const ComplexRowVector& a); | |
5275 | 91 ComplexDiagMatrix& fill (const ColumnVector& a, octave_idx_type beg); |
92 ComplexDiagMatrix& fill (const ComplexColumnVector& a, octave_idx_type beg); | |
93 ComplexDiagMatrix& fill (const RowVector& a, octave_idx_type beg); | |
94 ComplexDiagMatrix& fill (const ComplexRowVector& a, octave_idx_type beg); | |
458 | 95 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7620
diff
changeset
|
96 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
|
97 ComplexDiagMatrix transpose (void) const { return MDiagArray2<Complex>::transpose(); } |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
98 DiagMatrix abs (void) const; |
458 | 99 |
9237
3c1762c7e787
Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
100 friend OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a); |
458 | 101 |
1359 | 102 // resize is the destructive analog for this one |
458 | 103 |
5275 | 104 ComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; |
458 | 105 |
1359 | 106 // extract row or column i |
458 | 107 |
5275 | 108 ComplexRowVector row (octave_idx_type i) const; |
458 | 109 ComplexRowVector row (char *s) const; |
110 | |
5275 | 111 ComplexColumnVector column (octave_idx_type i) const; |
458 | 112 ComplexColumnVector column (char *s) const; |
113 | |
8811 | 114 ComplexDiagMatrix inverse (octave_idx_type& info) const; |
458 | 115 ComplexDiagMatrix inverse (void) const; |
8840
c690e3772583
support diagonal matrices in pinv
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
116 ComplexDiagMatrix pseudo_inverse (void) const; |
458 | 117 |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
118 bool all_elements_are_real (void) const; |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
119 |
1359 | 120 // diagonal matrix by diagonal matrix -> diagonal matrix operations |
458 | 121 |
122 ComplexDiagMatrix& operator += (const DiagMatrix& a); | |
123 ComplexDiagMatrix& operator -= (const DiagMatrix& a); | |
124 | |
1359 | 125 // other operations |
458 | 126 |
8375
e3c9102431a9
fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents:
8371
diff
changeset
|
127 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
|
128 { return MDiagArray2<Complex>::diag (k); } |
458 | 129 |
8371
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
130 ComplexDET determinant (void) const; |
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
131 double rcond (void) const; |
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
132 |
1359 | 133 // i/o |
458 | 134 |
3504 | 135 friend std::ostream& operator << (std::ostream& os, const ComplexDiagMatrix& a); |
458 | 136 |
137 private: | |
138 | |
5275 | 139 ComplexDiagMatrix (Complex *d, octave_idx_type nr, octave_idx_type nc) |
1989 | 140 : MDiagArray2<Complex> (d, nr, nc) { } |
458 | 141 }; |
142 | |
9237
3c1762c7e787
Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
143 OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a); |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
144 |
3504 | 145 // diagonal matrix by diagonal matrix -> diagonal matrix operations |
146 | |
9237
3c1762c7e787
Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
147 OCTAVE_API ComplexDiagMatrix |
3504 | 148 operator * (const ComplexDiagMatrix& a, const ComplexDiagMatrix& b); |
149 | |
9237
3c1762c7e787
Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
150 OCTAVE_API ComplexDiagMatrix |
3504 | 151 operator * (const ComplexDiagMatrix& a, const DiagMatrix& b); |
152 | |
9237
3c1762c7e787
Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
153 OCTAVE_API ComplexDiagMatrix |
3504 | 154 operator * (const DiagMatrix& a, const ComplexDiagMatrix& b); |
155 | |
3580 | 156 MDIAGARRAY2_FORWARD_DEFS (MDiagArray2, ComplexDiagMatrix, Complex) |
157 | |
458 | 158 #endif |
159 | |
160 /* | |
161 ;;; Local Variables: *** | |
162 ;;; mode: C++ *** | |
163 ;;; End: *** | |
164 */ |