Mercurial > octave
annotate liboctave/dDiagMatrix.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, 2006, |
4 2007 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_DiagMatrix_h) | |
25 #define octave_DiagMatrix_h 1 | |
26 | |
1989 | 27 #include "MDiagArray2.h" |
458 | 28 |
29 #include "dRowVector.h" | |
30 #include "dColVector.h" | |
31 | |
32 #include "mx-defs.h" | |
33 | |
3585 | 34 class |
6108 | 35 OCTAVE_API |
3585 | 36 DiagMatrix : public MDiagArray2<double> |
458 | 37 { |
38 friend class SVD; | |
39 friend class ComplexSVD; | |
40 | |
41 public: | |
42 | |
1989 | 43 DiagMatrix (void) : MDiagArray2<double> () { } |
3585 | 44 |
5275 | 45 DiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2<double> (r, c) { } |
3585 | 46 |
5275 | 47 DiagMatrix (octave_idx_type r, octave_idx_type c, double val) : MDiagArray2<double> (r, c, val) { } |
3585 | 48 |
49 DiagMatrix (const DiagMatrix& a) : MDiagArray2<double> (a) { } | |
50 | |
1989 | 51 DiagMatrix (const MDiagArray2<double>& a) : MDiagArray2<double> (a) { } |
3585 | 52 |
53 explicit DiagMatrix (const RowVector& a) : MDiagArray2<double> (a) { } | |
54 | |
55 explicit DiagMatrix (const ColumnVector& a) : MDiagArray2<double> (a) { } | |
458 | 56 |
57 DiagMatrix& operator = (const DiagMatrix& a) | |
58 { | |
1989 | 59 MDiagArray2<double>::operator = (a); |
458 | 60 return *this; |
61 } | |
62 | |
2385 | 63 bool operator == (const DiagMatrix& a) const; |
64 bool operator != (const DiagMatrix& a) const; | |
458 | 65 |
66 DiagMatrix& fill (double val); | |
5275 | 67 DiagMatrix& fill (double val, octave_idx_type beg, octave_idx_type end); |
458 | 68 DiagMatrix& fill (const ColumnVector& a); |
69 DiagMatrix& fill (const RowVector& a); | |
5275 | 70 DiagMatrix& fill (const ColumnVector& a, octave_idx_type beg); |
71 DiagMatrix& fill (const RowVector& a, octave_idx_type beg); | |
458 | 72 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7620
diff
changeset
|
73 DiagMatrix transpose (void) const { return MDiagArray2<double>::transpose(); } |
458 | 74 |
6153 | 75 friend OCTAVE_API DiagMatrix real (const ComplexDiagMatrix& a); |
76 friend OCTAVE_API DiagMatrix imag (const ComplexDiagMatrix& a); | |
1205 | 77 |
1359 | 78 // resize is the destructive analog for this one |
458 | 79 |
5275 | 80 Matrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; |
458 | 81 |
1359 | 82 // extract row or column i. |
458 | 83 |
5275 | 84 RowVector row (octave_idx_type i) const; |
458 | 85 RowVector row (char *s) const; |
86 | |
5275 | 87 ColumnVector column (octave_idx_type i) const; |
458 | 88 ColumnVector column (char *s) const; |
89 | |
90 DiagMatrix inverse (void) const; | |
91 DiagMatrix inverse (int& info) const; | |
92 | |
1359 | 93 // other operations |
458 | 94 |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
95 ColumnVector diag (octave_idx_type k = 0) const; |
458 | 96 |
1359 | 97 // i/o |
458 | 98 |
6153 | 99 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const DiagMatrix& a); |
458 | 100 |
101 private: | |
102 | |
5275 | 103 DiagMatrix (double *d, octave_idx_type nr, octave_idx_type nc) : MDiagArray2<double> (d, nr, nc) { } |
458 | 104 }; |
105 | |
3504 | 106 // diagonal matrix by diagonal matrix -> diagonal matrix operations |
107 | |
108 DiagMatrix | |
109 operator * (const DiagMatrix& a, const DiagMatrix& b); | |
110 | |
3580 | 111 MDIAGARRAY2_FORWARD_DEFS (MDiagArray2, DiagMatrix, double) |
112 | |
458 | 113 #endif |
114 | |
115 /* | |
116 ;;; Local Variables: *** | |
117 ;;; mode: C++ *** | |
118 ;;; End: *** | |
119 */ |