Mercurial > hg > octave-nkf
comparison liboctave/fDiagMatrix.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 | |
children | 8b1a2555c4e2 |
comparison
equal
deleted
inserted
replaced
7788:45f5faba05a2 | 7789:82be108cc558 |
---|---|
1 /* | |
2 | |
3 Copyright (C) 1994, 1995, 1996, 1997, 2000, 2002, 2004, 2005, 2006, | |
4 2007 John W. Eaton | |
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 | |
10 Free Software Foundation; either version 3 of the License, or (at your | |
11 option) any later version. | |
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 | |
19 along with Octave; see the file COPYING. If not, see | |
20 <http://www.gnu.org/licenses/>. | |
21 | |
22 */ | |
23 | |
24 #if !defined (octave_FloatDiagMatrix_h) | |
25 #define octave_FloatDiagMatrix_h 1 | |
26 | |
27 #include "MDiagArray2.h" | |
28 | |
29 #include "fRowVector.h" | |
30 #include "fColVector.h" | |
31 | |
32 #include "mx-defs.h" | |
33 | |
34 class | |
35 OCTAVE_API | |
36 FloatDiagMatrix : public MDiagArray2<float> | |
37 { | |
38 friend class FloatSVD; | |
39 friend class FloatComplexSVD; | |
40 | |
41 public: | |
42 | |
43 FloatDiagMatrix (void) : MDiagArray2<float> () { } | |
44 | |
45 FloatDiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2<float> (r, c) { } | |
46 | |
47 FloatDiagMatrix (octave_idx_type r, octave_idx_type c, float val) : MDiagArray2<float> (r, c, val) { } | |
48 | |
49 FloatDiagMatrix (const FloatDiagMatrix& a) : MDiagArray2<float> (a) { } | |
50 | |
51 FloatDiagMatrix (const MDiagArray2<float>& a) : MDiagArray2<float> (a) { } | |
52 | |
53 explicit FloatDiagMatrix (const FloatRowVector& a) : MDiagArray2<float> (a) { } | |
54 | |
55 explicit FloatDiagMatrix (const FloatColumnVector& a) : MDiagArray2<float> (a) { } | |
56 | |
57 FloatDiagMatrix& operator = (const FloatDiagMatrix& a) | |
58 { | |
59 MDiagArray2<float>::operator = (a); | |
60 return *this; | |
61 } | |
62 | |
63 bool operator == (const FloatDiagMatrix& a) const; | |
64 bool operator != (const FloatDiagMatrix& a) const; | |
65 | |
66 FloatDiagMatrix& fill (float val); | |
67 FloatDiagMatrix& fill (float val, octave_idx_type beg, octave_idx_type end); | |
68 FloatDiagMatrix& fill (const FloatColumnVector& a); | |
69 FloatDiagMatrix& fill (const FloatRowVector& a); | |
70 FloatDiagMatrix& fill (const FloatColumnVector& a, octave_idx_type beg); | |
71 FloatDiagMatrix& fill (const FloatRowVector& a, octave_idx_type beg); | |
72 | |
73 FloatDiagMatrix transpose (void) const { return MDiagArray2<float>::transpose(); } | |
74 | |
75 friend OCTAVE_API FloatDiagMatrix real (const FloatComplexDiagMatrix& a); | |
76 friend OCTAVE_API FloatDiagMatrix imag (const FloatComplexDiagMatrix& a); | |
77 | |
78 // resize is the destructive analog for this one | |
79 | |
80 FloatMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; | |
81 | |
82 // extract row or column i. | |
83 | |
84 FloatRowVector row (octave_idx_type i) const; | |
85 FloatRowVector row (char *s) const; | |
86 | |
87 FloatColumnVector column (octave_idx_type i) const; | |
88 FloatColumnVector column (char *s) const; | |
89 | |
90 FloatDiagMatrix inverse (void) const; | |
91 FloatDiagMatrix inverse (int& info) const; | |
92 | |
93 // other operations | |
94 | |
95 FloatColumnVector diag (octave_idx_type k = 0) const; | |
96 | |
97 // i/o | |
98 | |
99 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatDiagMatrix& a); | |
100 | |
101 private: | |
102 | |
103 FloatDiagMatrix (float *d, octave_idx_type nr, octave_idx_type nc) : MDiagArray2<float> (d, nr, nc) { } | |
104 }; | |
105 | |
106 // diagonal matrix by diagonal matrix -> diagonal matrix operations | |
107 | |
108 FloatDiagMatrix | |
109 operator * (const FloatDiagMatrix& a, const FloatDiagMatrix& b); | |
110 | |
111 MDIAGARRAY2_FORWARD_DEFS (MDiagArray2, FloatDiagMatrix, float) | |
112 | |
113 #endif | |
114 | |
115 /* | |
116 ;;; Local Variables: *** | |
117 ;;; mode: C++ *** | |
118 ;;; End: *** | |
119 */ |