Mercurial > hg > octave-nkf
annotate liboctave/dDiagMatrix.h @ 12107:1fc9fd052f0c release-3-2-x
fix typo in expm
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 25 Nov 2009 12:05:03 +0100 |
parents | 3c1762c7e787 |
children | 4c0cdbe0acca |
rev | line source |
---|---|
458 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1994, 1995, 1996, 1997, 2000, 2002, 2004, 2005, 2006, |
8920 | 4 2007, 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_DiagMatrix_h) | |
25 #define octave_DiagMatrix_h 1 | |
26 | |
1989 | 27 #include "MDiagArray2.h" |
458 | 28 |
29 #include "dRowVector.h" | |
30 #include "dColVector.h" | |
8371
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8367
diff
changeset
|
31 #include "DET.h" |
458 | 32 |
33 #include "mx-defs.h" | |
34 | |
3585 | 35 class |
6108 | 36 OCTAVE_API |
3585 | 37 DiagMatrix : public MDiagArray2<double> |
458 | 38 { |
39 friend class SVD; | |
40 friend class ComplexSVD; | |
41 | |
42 public: | |
43 | |
1989 | 44 DiagMatrix (void) : MDiagArray2<double> () { } |
3585 | 45 |
5275 | 46 DiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2<double> (r, c) { } |
3585 | 47 |
5275 | 48 DiagMatrix (octave_idx_type r, octave_idx_type c, double val) : MDiagArray2<double> (r, c, val) { } |
3585 | 49 |
50 DiagMatrix (const DiagMatrix& a) : MDiagArray2<double> (a) { } | |
51 | |
1989 | 52 DiagMatrix (const MDiagArray2<double>& a) : MDiagArray2<double> (a) { } |
3585 | 53 |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
54 template <class U> |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
55 DiagMatrix (const DiagArray2<U>& a) : MDiagArray2<double> (a) { } |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
56 |
3585 | 57 explicit DiagMatrix (const RowVector& a) : MDiagArray2<double> (a) { } |
58 | |
59 explicit DiagMatrix (const ColumnVector& a) : MDiagArray2<double> (a) { } | |
458 | 60 |
61 DiagMatrix& operator = (const DiagMatrix& a) | |
62 { | |
1989 | 63 MDiagArray2<double>::operator = (a); |
458 | 64 return *this; |
65 } | |
66 | |
2385 | 67 bool operator == (const DiagMatrix& a) const; |
68 bool operator != (const DiagMatrix& a) const; | |
458 | 69 |
70 DiagMatrix& fill (double val); | |
5275 | 71 DiagMatrix& fill (double val, octave_idx_type beg, octave_idx_type end); |
458 | 72 DiagMatrix& fill (const ColumnVector& a); |
73 DiagMatrix& fill (const RowVector& a); | |
5275 | 74 DiagMatrix& fill (const ColumnVector& a, octave_idx_type beg); |
75 DiagMatrix& fill (const RowVector& a, octave_idx_type beg); | |
458 | 76 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7620
diff
changeset
|
77 DiagMatrix transpose (void) const { return MDiagArray2<double>::transpose(); } |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
78 DiagMatrix abs (void) const; |
458 | 79 |
6153 | 80 friend OCTAVE_API DiagMatrix real (const ComplexDiagMatrix& a); |
81 friend OCTAVE_API DiagMatrix imag (const ComplexDiagMatrix& a); | |
1205 | 82 |
1359 | 83 // resize is the destructive analog for this one |
458 | 84 |
5275 | 85 Matrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; |
458 | 86 |
1359 | 87 // extract row or column i. |
458 | 88 |
5275 | 89 RowVector row (octave_idx_type i) const; |
458 | 90 RowVector row (char *s) const; |
91 | |
5275 | 92 ColumnVector column (octave_idx_type i) const; |
458 | 93 ColumnVector column (char *s) const; |
94 | |
95 DiagMatrix inverse (void) const; | |
8811 | 96 DiagMatrix inverse (octave_idx_type& info) const; |
8840
c690e3772583
support diagonal matrices in pinv
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
97 DiagMatrix pseudo_inverse (void) const; |
458 | 98 |
1359 | 99 // other operations |
458 | 100 |
8375
e3c9102431a9
fix design problems of diag & perm matrix classes
Jaroslav Hajek <highegg@gmail.com>
parents:
8371
diff
changeset
|
101 ColumnVector 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
|
102 { return MDiagArray2<double>::diag (k); } |
458 | 103 |
8371
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8367
diff
changeset
|
104 DET determinant (void) const; |
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8367
diff
changeset
|
105 double rcond (void) const; |
8367
445d27d79f4e
support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8366
diff
changeset
|
106 |
1359 | 107 // i/o |
458 | 108 |
6153 | 109 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const DiagMatrix& a); |
458 | 110 |
111 private: | |
112 | |
5275 | 113 DiagMatrix (double *d, octave_idx_type nr, octave_idx_type nc) : MDiagArray2<double> (d, nr, nc) { } |
458 | 114 }; |
115 | |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
116 OCTAVE_API DiagMatrix real (const ComplexDiagMatrix& a); |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
117 OCTAVE_API DiagMatrix imag (const ComplexDiagMatrix& a); |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
118 |
3504 | 119 // diagonal matrix by diagonal matrix -> diagonal matrix operations |
120 | |
9237
3c1762c7e787
Add missing xxx_API decoration and remove misplaced ones
Michael Goffioul <michael.goffioul@gmail.com>
parents:
8920
diff
changeset
|
121 OCTAVE_API DiagMatrix |
3504 | 122 operator * (const DiagMatrix& a, const DiagMatrix& b); |
123 | |
3580 | 124 MDIAGARRAY2_FORWARD_DEFS (MDiagArray2, DiagMatrix, double) |
125 | |
458 | 126 #endif |
127 | |
128 /* | |
129 ;;; Local Variables: *** | |
130 ;;; mode: C++ *** | |
131 ;;; End: *** | |
132 */ |