Mercurial > hg > octave-lyh
annotate liboctave/array/CDiagMatrix.h @ 16660:cbb1bb7a5c3d
Added tag ss-3-7-5 for changeset 608e307b4914
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 14 May 2013 05:23:53 -0400 |
parents | 0a0912a9ab6e |
children |
rev | line source |
---|---|
458 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
3 Copyright (C) 1994-2012 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" | |
8371
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
32 #include "DET.h" |
458 | 33 |
34 #include "mx-defs.h" | |
35 | |
3585 | 36 class |
9237
3c1762c7e787
Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
37 OCTAVE_API |
3585 | 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 |
10363
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
49 explicit ComplexDiagMatrix (const Array<Complex>& a) |
3585 | 50 : MDiagArray2<Complex> (a) { } |
51 | |
10363
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
52 explicit ComplexDiagMatrix (const Array<double>& a) |
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
53 : MDiagArray2<Complex> (Array<Complex> (a)) { } |
3585 | 54 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
55 ComplexDiagMatrix (const Array<Complex>& a, octave_idx_type r, octave_idx_type c) |
10363
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
56 : MDiagArray2<Complex> (a, r, c) { } |
3585 | 57 |
58 explicit ComplexDiagMatrix (const DiagMatrix& a); | |
59 | |
1989 | 60 ComplexDiagMatrix (const MDiagArray2<Complex>& a) |
61 : MDiagArray2<Complex> (a) { } | |
3585 | 62 |
63 ComplexDiagMatrix (const ComplexDiagMatrix& a) | |
64 : MDiagArray2<Complex> (a) { } | |
458 | 65 |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
66 template <class U> |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
67 ComplexDiagMatrix (const DiagArray2<U>& a) |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
68 : MDiagArray2<Complex> (a) { } |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
69 |
458 | 70 ComplexDiagMatrix& operator = (const ComplexDiagMatrix& a) |
71 { | |
1989 | 72 MDiagArray2<Complex>::operator = (a); |
458 | 73 return *this; |
74 } | |
75 | |
2386 | 76 bool operator == (const ComplexDiagMatrix& a) const; |
77 bool operator != (const ComplexDiagMatrix& a) const; | |
458 | 78 |
79 ComplexDiagMatrix& fill (double val); | |
80 ComplexDiagMatrix& fill (const Complex& val); | |
5275 | 81 ComplexDiagMatrix& fill (double val, octave_idx_type beg, octave_idx_type end); |
82 ComplexDiagMatrix& fill (const Complex& val, octave_idx_type beg, octave_idx_type end); | |
458 | 83 ComplexDiagMatrix& fill (const ColumnVector& a); |
84 ComplexDiagMatrix& fill (const ComplexColumnVector& a); | |
85 ComplexDiagMatrix& fill (const RowVector& a); | |
86 ComplexDiagMatrix& fill (const ComplexRowVector& a); | |
5275 | 87 ComplexDiagMatrix& fill (const ColumnVector& a, octave_idx_type beg); |
88 ComplexDiagMatrix& fill (const ComplexColumnVector& a, octave_idx_type beg); | |
89 ComplexDiagMatrix& fill (const RowVector& a, octave_idx_type beg); | |
90 ComplexDiagMatrix& fill (const ComplexRowVector& a, octave_idx_type beg); | |
458 | 91 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7620
diff
changeset
|
92 ComplexDiagMatrix hermitian (void) const { return MDiagArray2<Complex>::hermitian (std::conj); } |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
93 ComplexDiagMatrix transpose (void) const { return MDiagArray2<Complex>::transpose (); } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
94 DiagMatrix abs (void) const; |
458 | 95 |
9237
3c1762c7e787
Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
96 friend OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a); |
458 | 97 |
1359 | 98 // resize is the destructive analog for this one |
458 | 99 |
5275 | 100 ComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; |
458 | 101 |
1359 | 102 // extract row or column i |
458 | 103 |
5275 | 104 ComplexRowVector row (octave_idx_type i) const; |
458 | 105 ComplexRowVector row (char *s) const; |
106 | |
5275 | 107 ComplexColumnVector column (octave_idx_type i) const; |
458 | 108 ComplexColumnVector column (char *s) const; |
109 | |
8811 | 110 ComplexDiagMatrix inverse (octave_idx_type& info) const; |
458 | 111 ComplexDiagMatrix inverse (void) const; |
8840
c690e3772583
support diagonal matrices in pinv
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
112 ComplexDiagMatrix pseudo_inverse (void) const; |
458 | 113 |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
114 bool all_elements_are_real (void) const; |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
115 |
1359 | 116 // diagonal matrix by diagonal matrix -> diagonal matrix operations |
458 | 117 |
118 ComplexDiagMatrix& operator += (const DiagMatrix& a); | |
119 ComplexDiagMatrix& operator -= (const DiagMatrix& a); | |
120 | |
1359 | 121 // other operations |
458 | 122 |
15448
0a0912a9ab6e
Replace deprecated DiagArray2<T>::diag calls with DiagArray2<T>::extract_diag
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15271
diff
changeset
|
123 ComplexColumnVector extract_diag (octave_idx_type k = 0) const |
0a0912a9ab6e
Replace deprecated DiagArray2<T>::diag calls with DiagArray2<T>::extract_diag
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
15271
diff
changeset
|
124 { return MDiagArray2<Complex>::extract_diag (k); } |
458 | 125 |
8371
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
126 ComplexDET determinant (void) const; |
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
127 double rcond (void) const; |
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
128 |
1359 | 129 // i/o |
458 | 130 |
3504 | 131 friend std::ostream& operator << (std::ostream& os, const ComplexDiagMatrix& a); |
458 | 132 |
133 }; | |
134 | |
9237
3c1762c7e787
Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
135 OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a); |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
136 |
3504 | 137 // diagonal matrix by diagonal matrix -> diagonal matrix operations |
138 | |
9237
3c1762c7e787
Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
139 OCTAVE_API ComplexDiagMatrix |
3504 | 140 operator * (const ComplexDiagMatrix& a, const ComplexDiagMatrix& b); |
141 | |
9237
3c1762c7e787
Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
142 OCTAVE_API ComplexDiagMatrix |
3504 | 143 operator * (const ComplexDiagMatrix& a, const DiagMatrix& b); |
144 | |
9237
3c1762c7e787
Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
145 OCTAVE_API ComplexDiagMatrix |
3504 | 146 operator * (const DiagMatrix& a, const ComplexDiagMatrix& b); |
147 | |
3580 | 148 MDIAGARRAY2_FORWARD_DEFS (MDiagArray2, ComplexDiagMatrix, Complex) |
149 | |
458 | 150 #endif |