1 | /*! |
---|
2 | * \file |
---|
3 | * \brief Definitions of eigenvalue decomposition functions |
---|
4 | * \author Tony Ottosson |
---|
5 | * |
---|
6 | * ------------------------------------------------------------------------- |
---|
7 | * |
---|
8 | * IT++ - C++ library of mathematical, signal processing, speech processing, |
---|
9 | * and communications classes and functions |
---|
10 | * |
---|
11 | * Copyright (C) 1995-2007 (see AUTHORS file for a list of contributors) |
---|
12 | * |
---|
13 | * This program is free software; you can redistribute it and/or modify |
---|
14 | * it under the terms of the GNU General Public License as published by |
---|
15 | * the Free Software Foundation; either version 2 of the License, or |
---|
16 | * (at your option) any later version. |
---|
17 | * |
---|
18 | * This program is distributed in the hope that it will be useful, |
---|
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
21 | * GNU General Public License for more details. |
---|
22 | * |
---|
23 | * You should have received a copy of the GNU General Public License |
---|
24 | * along with this program; if not, write to the Free Software |
---|
25 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
26 | * |
---|
27 | * ------------------------------------------------------------------------- |
---|
28 | */ |
---|
29 | |
---|
30 | #ifndef EIGEN_H |
---|
31 | #define EIGEN_H |
---|
32 | |
---|
33 | #include <itpp/base/mat.h> |
---|
34 | |
---|
35 | |
---|
36 | namespace itpp { |
---|
37 | |
---|
38 | /*! |
---|
39 | \ingroup matrixdecomp |
---|
40 | \brief Calculates the eigenvalues and eigenvectors of a symmetric real matrix |
---|
41 | |
---|
42 | The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors |
---|
43 | \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the real and symmetric \f$n \times n\f$ |
---|
44 | matrix \f$\mathbf{A}\f$ satisfies |
---|
45 | \f[ |
---|
46 | \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. |
---|
47 | \f] |
---|
48 | The eigenvectors are the columns of the matrix V. |
---|
49 | True is returned if the calculation was successful. Otherwise false. |
---|
50 | |
---|
51 | Uses the LAPACK routine DSYEV. |
---|
52 | */ |
---|
53 | bool eig_sym(const mat &A, vec &d, mat &V); |
---|
54 | |
---|
55 | /*! |
---|
56 | \ingroup matrixdecomp |
---|
57 | \brief Calculates the eigenvalues of a symmetric real matrix |
---|
58 | |
---|
59 | The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors |
---|
60 | \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the real and symmetric \f$n \times n\f$ |
---|
61 | matrix \f$\mathbf{A}\f$ satisfies |
---|
62 | \f[ |
---|
63 | \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. |
---|
64 | \f] |
---|
65 | True is returned if the calculation was successful. Otherwise false. |
---|
66 | |
---|
67 | Uses the LAPACK routine DSYEV. |
---|
68 | */ |
---|
69 | bool eig_sym(const mat &A, vec &d); |
---|
70 | |
---|
71 | /*! |
---|
72 | \ingroup matrixdecomp |
---|
73 | \brief Calculates the eigenvalues of a symmetric real matrix |
---|
74 | |
---|
75 | The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors |
---|
76 | \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the real and symmetric \f$n \times n\f$ |
---|
77 | matrix \f$\mathbf{A}\f$ satisfies |
---|
78 | \f[ |
---|
79 | \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. |
---|
80 | \f] |
---|
81 | |
---|
82 | Uses the LAPACK routine DSYEV. |
---|
83 | */ |
---|
84 | vec eig_sym(const mat &A); |
---|
85 | |
---|
86 | /*! |
---|
87 | \ingroup matrixdecomp |
---|
88 | \brief Calculates the eigenvalues and eigenvectors of a hermitian complex matrix |
---|
89 | |
---|
90 | The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors |
---|
91 | \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the complex and hermitian \f$n \times n\f$ |
---|
92 | matrix \f$\mathbf{A}\f$ satisfies |
---|
93 | \f[ |
---|
94 | \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. |
---|
95 | \f] |
---|
96 | The eigenvectors are the columns of the matrix V. |
---|
97 | True is returned if the calculation was successful. Otherwise false. |
---|
98 | |
---|
99 | Uses the LAPACK routine ZHEEV. |
---|
100 | */ |
---|
101 | bool eig_sym(const cmat &A, vec &d, cmat &V); |
---|
102 | |
---|
103 | /*! |
---|
104 | \ingroup matrixdecomp |
---|
105 | \brief Calculates the eigenvalues of a hermitian complex matrix |
---|
106 | |
---|
107 | The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors |
---|
108 | \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the complex and hermitian \f$n \times n\f$ |
---|
109 | matrix \f$\mathbf{A}\f$ satisfies |
---|
110 | \f[ |
---|
111 | \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. |
---|
112 | \f] |
---|
113 | True is returned if the calculation was successful. Otherwise false. |
---|
114 | |
---|
115 | Uses the LAPACK routine ZHEEV. |
---|
116 | */ |
---|
117 | bool eig_sym(const cmat &A, vec &d); |
---|
118 | |
---|
119 | /*! |
---|
120 | \ingroup matrixdecomp |
---|
121 | \brief Calculates the eigenvalues of a hermitian complex matrix |
---|
122 | |
---|
123 | The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors |
---|
124 | \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the complex and hermitian \f$n \times n\f$ |
---|
125 | matrix \f$\mathbf{A}\f$ satisfies |
---|
126 | \f[ |
---|
127 | \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. |
---|
128 | \f] |
---|
129 | |
---|
130 | Uses the LAPACK routine ZHEEV. |
---|
131 | */ |
---|
132 | vec eig_sym(const cmat &A); |
---|
133 | |
---|
134 | /*! |
---|
135 | \ingroup matrixdecomp |
---|
136 | \brief Caclulates the eigenvalues and eigenvectors of a real non-symmetric matrix |
---|
137 | |
---|
138 | The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors |
---|
139 | \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the real \f$n \times n\f$ |
---|
140 | matrix \f$\mathbf{A}\f$ satisfies |
---|
141 | \f[ |
---|
142 | \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. |
---|
143 | \f] |
---|
144 | The eigenvectors are the columns of the matrix V. |
---|
145 | True is returned if the calculation was successful. Otherwise false. |
---|
146 | |
---|
147 | Uses the LAPACK routine DGEEV. |
---|
148 | */ |
---|
149 | bool eig(const mat &A, cvec &d, cmat &V); |
---|
150 | |
---|
151 | /*! |
---|
152 | \ingroup matrixdecomp |
---|
153 | \brief Caclulates the eigenvalues of a real non-symmetric matrix |
---|
154 | |
---|
155 | The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors |
---|
156 | \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the real \f$n \times n\f$ |
---|
157 | matrix \f$\mathbf{A}\f$ satisfies |
---|
158 | \f[ |
---|
159 | \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. |
---|
160 | \f] |
---|
161 | True is returned if the calculation was successful. Otherwise false. |
---|
162 | |
---|
163 | Uses the LAPACK routine DGEEV. |
---|
164 | */ |
---|
165 | bool eig(const mat &A, cvec &d); |
---|
166 | |
---|
167 | /*! |
---|
168 | \ingroup matrixdecomp |
---|
169 | \brief Caclulates the eigenvalues of a real non-symmetric matrix |
---|
170 | |
---|
171 | The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors |
---|
172 | \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the real \f$n \times n\f$ |
---|
173 | matrix \f$\mathbf{A}\f$ satisfies |
---|
174 | \f[ |
---|
175 | \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. |
---|
176 | \f] |
---|
177 | |
---|
178 | Uses the LAPACK routine DGEEV. |
---|
179 | */ |
---|
180 | cvec eig(const mat &A); |
---|
181 | |
---|
182 | /*! |
---|
183 | \ingroup matrixdecomp |
---|
184 | \brief Calculates the eigenvalues and eigenvectors of a complex non-hermitian matrix |
---|
185 | |
---|
186 | The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors |
---|
187 | \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the complex \f$n \times n\f$ |
---|
188 | matrix \f$\mathbf{A}\f$ satisfies |
---|
189 | \f[ |
---|
190 | \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. |
---|
191 | \f] |
---|
192 | The eigenvectors are the columns of the matrix V. |
---|
193 | True is returned if the calculation was successful. Otherwise false. |
---|
194 | |
---|
195 | Uses the LAPACK routine ZGEEV. |
---|
196 | */ |
---|
197 | bool eig(const cmat &A, cvec &d, cmat &V); |
---|
198 | |
---|
199 | /*! |
---|
200 | \ingroup matrixdecomp |
---|
201 | \brief Calculates the eigenvalues of a complex non-hermitian matrix |
---|
202 | |
---|
203 | The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors |
---|
204 | \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the complex \f$n \times n\f$ |
---|
205 | matrix \f$\mathbf{A}\f$ satisfies |
---|
206 | \f[ |
---|
207 | \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. |
---|
208 | \f] |
---|
209 | True is returned if the calculation was successful. Otherwise false. |
---|
210 | |
---|
211 | Uses the LAPACK routine ZGEEV. |
---|
212 | */ |
---|
213 | bool eig(const cmat &A, cvec &d); |
---|
214 | |
---|
215 | /*! |
---|
216 | \ingroup matrixdecomp |
---|
217 | \brief Calculates the eigenvalues of a complex non-hermitian matrix |
---|
218 | |
---|
219 | The Eigenvalues \f$\mathbf{d}(d_0, d_1, \ldots, d_{n-1})\f$ and the eigenvectors |
---|
220 | \f$\mathbf{v}_i, \: i=0, \ldots, n-1\f$ of the complex \f$n \times n\f$ |
---|
221 | matrix \f$\mathbf{A}\f$ satisfies |
---|
222 | \f[ |
---|
223 | \mathbf{A} \mathbf{v}_i = d_i \mathbf{v}_i\: i=0, \ldots, n-1. |
---|
224 | \f] |
---|
225 | |
---|
226 | Uses the LAPACK routine ZGEEV. |
---|
227 | */ |
---|
228 | cvec eig(const cmat &A); |
---|
229 | |
---|
230 | } // namespace itpp |
---|
231 | |
---|
232 | #endif // #ifndef EIGEN_H |
---|