Mercurial > hg > octave-nkf
annotate liboctave/CDiagMatrix.h @ 10480:19e1e4470e01
remove old sparse assembly ctors
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 31 Mar 2010 10:24:57 +0200 |
parents | 96ed7c629bbd |
children | fd0a3ac60b0e |
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 |
10363
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
50 explicit ComplexDiagMatrix (const Array<Complex>& a) |
3585 | 51 : MDiagArray2<Complex> (a) { } |
52 | |
10363
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
53 explicit ComplexDiagMatrix (const Array<double>& a) |
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
54 : MDiagArray2<Complex> (Array<Complex> (a)) { } |
3585 | 55 |
10363
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
56 ComplexDiagMatrix (const Array<Complex>& a, octave_idx_type r, octave_idx_type c) |
a0728e81ed25
improve diag matrix interface & implementation
Jaroslav Hajek <highegg@gmail.com>
parents:
10158
diff
changeset
|
57 : MDiagArray2<Complex> (a, r, c) { } |
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 |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
67 template <class U> |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
68 ComplexDiagMatrix (const DiagArray2<U>& a) |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
69 : MDiagArray2<Complex> (a) { } |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
70 |
458 | 71 ComplexDiagMatrix& operator = (const ComplexDiagMatrix& a) |
72 { | |
1989 | 73 MDiagArray2<Complex>::operator = (a); |
458 | 74 return *this; |
75 } | |
76 | |
2386 | 77 bool operator == (const ComplexDiagMatrix& a) const; |
78 bool operator != (const ComplexDiagMatrix& a) const; | |
458 | 79 |
80 ComplexDiagMatrix& fill (double val); | |
81 ComplexDiagMatrix& fill (const Complex& val); | |
5275 | 82 ComplexDiagMatrix& fill (double val, octave_idx_type beg, octave_idx_type end); |
83 ComplexDiagMatrix& fill (const Complex& val, octave_idx_type beg, octave_idx_type end); | |
458 | 84 ComplexDiagMatrix& fill (const ColumnVector& a); |
85 ComplexDiagMatrix& fill (const ComplexColumnVector& a); | |
86 ComplexDiagMatrix& fill (const RowVector& a); | |
87 ComplexDiagMatrix& fill (const ComplexRowVector& a); | |
5275 | 88 ComplexDiagMatrix& fill (const ColumnVector& a, octave_idx_type beg); |
89 ComplexDiagMatrix& fill (const ComplexColumnVector& a, octave_idx_type beg); | |
90 ComplexDiagMatrix& fill (const RowVector& a, octave_idx_type beg); | |
91 ComplexDiagMatrix& fill (const ComplexRowVector& a, octave_idx_type beg); | |
458 | 92 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7620
diff
changeset
|
93 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
|
94 ComplexDiagMatrix transpose (void) const { return MDiagArray2<Complex>::transpose(); } |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
95 DiagMatrix abs (void) const; |
458 | 96 |
9237
3c1762c7e787
Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
97 friend OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a); |
458 | 98 |
1359 | 99 // resize is the destructive analog for this one |
458 | 100 |
5275 | 101 ComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; |
458 | 102 |
1359 | 103 // extract row or column i |
458 | 104 |
5275 | 105 ComplexRowVector row (octave_idx_type i) const; |
458 | 106 ComplexRowVector row (char *s) const; |
107 | |
5275 | 108 ComplexColumnVector column (octave_idx_type i) const; |
458 | 109 ComplexColumnVector column (char *s) const; |
110 | |
8811 | 111 ComplexDiagMatrix inverse (octave_idx_type& info) const; |
458 | 112 ComplexDiagMatrix inverse (void) const; |
8840
c690e3772583
support diagonal matrices in pinv
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
113 ComplexDiagMatrix pseudo_inverse (void) const; |
458 | 114 |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
115 bool all_elements_are_real (void) const; |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
116 |
1359 | 117 // diagonal matrix by diagonal matrix -> diagonal matrix operations |
458 | 118 |
119 ComplexDiagMatrix& operator += (const DiagMatrix& a); | |
120 ComplexDiagMatrix& operator -= (const DiagMatrix& a); | |
121 | |
1359 | 122 // other operations |
458 | 123 |
8375
e3c9102431a9
fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents:
8371
diff
changeset
|
124 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
|
125 { return MDiagArray2<Complex>::diag (k); } |
458 | 126 |
8371
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
127 ComplexDET determinant (void) const; |
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
128 double rcond (void) const; |
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
129 |
1359 | 130 // i/o |
458 | 131 |
3504 | 132 friend std::ostream& operator << (std::ostream& os, const ComplexDiagMatrix& a); |
458 | 133 |
134 }; | |
135 | |
9237
3c1762c7e787
Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
136 OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a); |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
137 |
3504 | 138 // diagonal matrix by diagonal matrix -> diagonal matrix operations |
139 | |
9237
3c1762c7e787
Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
140 OCTAVE_API ComplexDiagMatrix |
3504 | 141 operator * (const ComplexDiagMatrix& a, const ComplexDiagMatrix& b); |
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 |
3504 | 144 operator * (const ComplexDiagMatrix& a, const DiagMatrix& b); |
145 | |
9237
3c1762c7e787
Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
146 OCTAVE_API ComplexDiagMatrix |
3504 | 147 operator * (const DiagMatrix& a, const ComplexDiagMatrix& b); |
148 | |
3580 | 149 MDIAGARRAY2_FORWARD_DEFS (MDiagArray2, ComplexDiagMatrix, Complex) |
150 | |
458 | 151 #endif |