Mercurial > hg > octave-lyh
annotate liboctave/EIG.h @ 10396:a0b51ac0f88a
optimize accumdim with summation
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 05 Mar 2010 12:31:30 +0100 |
parents | cbc402e64d83 |
children | 367bfee35ba0 |
rev | line source |
---|---|
462 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1994, 1995, 1996, 1997, 2000, 2002, 2004, 2005, 2006, |
8920 | 4 2007, 2008 John W. Eaton |
462 | 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. | |
462 | 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/>. | |
462 | 21 |
22 */ | |
23 | |
24 #if !defined (octave_EIG_h) | |
25 #define octave_EIG_h 1 | |
26 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
27 #include <iosfwd> |
462 | 28 |
29 #include "dMatrix.h" | |
30 #include "CMatrix.h" | |
31 #include "CColVector.h" | |
32 | |
1867 | 33 class |
6108 | 34 OCTAVE_API |
1867 | 35 EIG |
462 | 36 { |
37 friend class Matrix; | |
38 friend class ComplexMatrix; | |
39 | |
40 public: | |
41 | |
1867 | 42 EIG (void) |
43 : lambda (), v () { } | |
462 | 44 |
4725 | 45 EIG (const Matrix& a, bool calc_eigenvectors = true) |
46 { init (a, calc_eigenvectors); } | |
1867 | 47 |
5275 | 48 EIG (const Matrix& a, octave_idx_type& info, bool calc_eigenvectors = true) |
4725 | 49 { info = init (a, calc_eigenvectors); } |
1528 | 50 |
8339
18c4ded8612a
Add generalized eigenvalue functions
Jarkko Kaleva <d3roga@gmail.com>
parents:
7017
diff
changeset
|
51 EIG (const Matrix& a, const Matrix& b, bool calc_eigenvectors = true) |
18c4ded8612a
Add generalized eigenvalue functions
Jarkko Kaleva <d3roga@gmail.com>
parents:
7017
diff
changeset
|
52 { init (a, b, calc_eigenvectors); } |
18c4ded8612a
Add generalized eigenvalue functions
Jarkko Kaleva <d3roga@gmail.com>
parents:
7017
diff
changeset
|
53 |
18c4ded8612a
Add generalized eigenvalue functions
Jarkko Kaleva <d3roga@gmail.com>
parents:
7017
diff
changeset
|
54 EIG (const Matrix& a, const Matrix& b, octave_idx_type& info, bool calc_eigenvectors = true) |
18c4ded8612a
Add generalized eigenvalue functions
Jarkko Kaleva <d3roga@gmail.com>
parents:
7017
diff
changeset
|
55 { info = init (a, b, calc_eigenvectors); } |
18c4ded8612a
Add generalized eigenvalue functions
Jarkko Kaleva <d3roga@gmail.com>
parents:
7017
diff
changeset
|
56 |
4725 | 57 EIG (const ComplexMatrix& a, bool calc_eigenvectors = true) |
58 { init (a, calc_eigenvectors); } | |
1867 | 59 |
5275 | 60 EIG (const ComplexMatrix& a, octave_idx_type& info, bool calc_eigenvectors = true) |
4725 | 61 { info = init (a, calc_eigenvectors); } |
462 | 62 |
8339
18c4ded8612a
Add generalized eigenvalue functions
Jarkko Kaleva <d3roga@gmail.com>
parents:
7017
diff
changeset
|
63 EIG (const ComplexMatrix& a, const ComplexMatrix& b, bool calc_eigenvectors = true) |
18c4ded8612a
Add generalized eigenvalue functions
Jarkko Kaleva <d3roga@gmail.com>
parents:
7017
diff
changeset
|
64 { init (a, b, calc_eigenvectors); } |
18c4ded8612a
Add generalized eigenvalue functions
Jarkko Kaleva <d3roga@gmail.com>
parents:
7017
diff
changeset
|
65 |
18c4ded8612a
Add generalized eigenvalue functions
Jarkko Kaleva <d3roga@gmail.com>
parents:
7017
diff
changeset
|
66 EIG (const ComplexMatrix& a, const ComplexMatrix& b, octave_idx_type& info, bool calc_eigenvectors = true) |
18c4ded8612a
Add generalized eigenvalue functions
Jarkko Kaleva <d3roga@gmail.com>
parents:
7017
diff
changeset
|
67 { info = init (a, b, calc_eigenvectors); } |
18c4ded8612a
Add generalized eigenvalue functions
Jarkko Kaleva <d3roga@gmail.com>
parents:
7017
diff
changeset
|
68 |
1528 | 69 EIG (const EIG& a) |
1867 | 70 : lambda (a.lambda), v (a.v) { } |
462 | 71 |
1528 | 72 EIG& operator = (const EIG& a) |
73 { | |
1867 | 74 if (this != &a) |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
75 { |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
76 lambda = a.lambda; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
77 v = a.v; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
78 } |
1528 | 79 return *this; |
80 } | |
81 | |
1934 | 82 ~EIG (void) { } |
83 | |
1528 | 84 ComplexColumnVector eigenvalues (void) const { return lambda; } |
85 | |
86 ComplexMatrix eigenvectors (void) const { return v; } | |
462 | 87 |
3504 | 88 friend std::ostream& operator << (std::ostream& os, const EIG& a); |
462 | 89 |
90 private: | |
91 | |
1867 | 92 ComplexColumnVector lambda; |
93 ComplexMatrix v; | |
94 | |
5275 | 95 octave_idx_type init (const Matrix& a, bool calc_eigenvectors); |
8339
18c4ded8612a
Add generalized eigenvalue functions
Jarkko Kaleva <d3roga@gmail.com>
parents:
7017
diff
changeset
|
96 octave_idx_type init (const Matrix& a, const Matrix& b, bool calc_eigenvectors); |
5275 | 97 octave_idx_type init (const ComplexMatrix& a, bool calc_eigenvectors); |
8339
18c4ded8612a
Add generalized eigenvalue functions
Jarkko Kaleva <d3roga@gmail.com>
parents:
7017
diff
changeset
|
98 octave_idx_type init (const ComplexMatrix& a, const ComplexMatrix& b, bool calc_eigenvectors); |
2815 | 99 |
5275 | 100 octave_idx_type symmetric_init (const Matrix& a, bool calc_eigenvectors); |
8339
18c4ded8612a
Add generalized eigenvalue functions
Jarkko Kaleva <d3roga@gmail.com>
parents:
7017
diff
changeset
|
101 octave_idx_type symmetric_init (const Matrix& a, const Matrix& b, bool calc_eigenvectors); |
5275 | 102 octave_idx_type hermitian_init (const ComplexMatrix& a, bool calc_eigenvectors); |
8339
18c4ded8612a
Add generalized eigenvalue functions
Jarkko Kaleva <d3roga@gmail.com>
parents:
7017
diff
changeset
|
103 octave_idx_type hermitian_init (const ComplexMatrix& a, const ComplexMatrix& b, bool calc_eigenvectors); |
462 | 104 }; |
105 | |
106 #endif |