462
|
1 // -*- C++ -*- |
|
2 /* |
|
3 |
|
4 Copyright (C) 1992, 1993, 1994 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 2, or (at your option) any |
|
11 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, write to the Free |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_EIG_h) |
|
25 #define octave_EIG_h 1 |
|
26 |
|
27 #if defined (__GNUG__) |
|
28 #pragma interface |
|
29 #endif |
|
30 |
|
31 class ostream; |
|
32 |
|
33 #include "dMatrix.h" |
|
34 #include "CMatrix.h" |
|
35 #include "CColVector.h" |
|
36 |
|
37 extern "C++" { |
|
38 |
|
39 class EIG |
|
40 { |
|
41 friend class Matrix; |
|
42 friend class ComplexMatrix; |
|
43 |
|
44 public: |
|
45 |
|
46 EIG (void) {} |
|
47 |
|
48 EIG (const Matrix& a); |
|
49 EIG (const Matrix& a, int& info); |
|
50 |
|
51 EIG (const ComplexMatrix& a); |
|
52 EIG (const ComplexMatrix& a, int& info); |
|
53 |
|
54 EIG (const EIG& a); |
|
55 |
|
56 EIG& operator = (const EIG& a); |
|
57 |
|
58 ComplexColumnVector eigenvalues (void) const; |
|
59 ComplexMatrix eigenvectors (void) const; |
|
60 |
|
61 friend ostream& operator << (ostream& os, const EIG& a); |
|
62 |
|
63 private: |
|
64 |
|
65 int init (const Matrix& a); |
|
66 int init (const ComplexMatrix& a); |
|
67 |
|
68 ComplexColumnVector lambda; |
|
69 ComplexMatrix v; |
|
70 }; |
|
71 |
|
72 inline EIG::EIG (const Matrix& a) |
|
73 { |
|
74 init (a); |
|
75 } |
|
76 |
|
77 inline EIG::EIG (const Matrix& a, int& info) |
|
78 { |
|
79 info = init (a); |
|
80 } |
|
81 |
|
82 inline EIG::EIG (const ComplexMatrix& a) |
|
83 { |
|
84 init (a); |
|
85 } |
|
86 |
|
87 inline EIG::EIG (const ComplexMatrix& a, int& info) |
|
88 { |
|
89 info = init (a); |
|
90 } |
|
91 |
|
92 inline EIG::EIG (const EIG& a) |
|
93 { |
|
94 lambda = a.lambda; |
|
95 v = a.v; |
|
96 } |
|
97 |
|
98 inline EIG& EIG::operator = (const EIG& a) |
|
99 { |
|
100 lambda = a.lambda; |
|
101 v = a.v; |
|
102 return *this; |
|
103 } |
|
104 |
|
105 inline ComplexColumnVector EIG::eigenvalues (void) const |
|
106 { |
|
107 return lambda; |
|
108 } |
|
109 |
|
110 inline ComplexMatrix EIG::eigenvectors (void) const |
|
111 { |
|
112 return v; |
|
113 } |
|
114 |
|
115 } // extern "C++" |
|
116 |
|
117 #endif |
|
118 |
|
119 /* |
|
120 ;;; Local Variables: *** |
|
121 ;;; mode: C++ *** |
|
122 ;;; page-delimiter: "^/\\*" *** |
|
123 ;;; End: *** |
|
124 */ |