Mercurial > octave
annotate liboctave/CDiagMatrix.h @ 7789:82be108cc558
First attempt at single precision tyeps
* * *
corrections to qrupdate single precision routines
* * *
prefer demotion to single over promotion to double
* * *
Add single precision support to log2 function
* * *
Trivial PROJECT file update
* * *
Cache optimized hermitian/transpose methods
* * *
Add tests for tranpose/hermitian and ChangeLog entry for new transpose code
author | David Bateman <dbateman@free.fr> |
---|---|
date | Sun, 27 Apr 2008 22:34:17 +0200 |
parents | 36594d5bbe13 |
children | 8b1a2555c4e2 |
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" | |
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 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7620
diff
changeset
|
90 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
|
91 ComplexDiagMatrix transpose (void) const { return MDiagArray2<Complex>::transpose(); } |
458 | 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 |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
117 ComplexColumnVector diag (octave_idx_type k = 0) const; |
458 | 118 |
1359 | 119 // i/o |
458 | 120 |
3504 | 121 friend std::ostream& operator << (std::ostream& os, const ComplexDiagMatrix& a); |
458 | 122 |
123 private: | |
124 | |
5275 | 125 ComplexDiagMatrix (Complex *d, octave_idx_type nr, octave_idx_type nc) |
1989 | 126 : MDiagArray2<Complex> (d, nr, nc) { } |
458 | 127 }; |
128 | |
3504 | 129 // diagonal matrix by diagonal matrix -> diagonal matrix operations |
130 | |
131 ComplexDiagMatrix | |
132 operator * (const ComplexDiagMatrix& a, const ComplexDiagMatrix& b); | |
133 | |
134 ComplexDiagMatrix | |
135 operator * (const ComplexDiagMatrix& a, const DiagMatrix& b); | |
136 | |
137 ComplexDiagMatrix | |
138 operator * (const DiagMatrix& a, const ComplexDiagMatrix& b); | |
139 | |
3580 | 140 MDIAGARRAY2_FORWARD_DEFS (MDiagArray2, ComplexDiagMatrix, Complex) |
141 | |
458 | 142 #endif |
143 | |
144 /* | |
145 ;;; Local Variables: *** | |
146 ;;; mode: C++ *** | |
147 ;;; End: *** | |
148 */ |