2 |
bj |
1 |
#ifndef __CGLA_EIGENSOLUTION_H__
|
|
|
2 |
#define __CGLA_EIGENSOLUTION_H__
|
|
|
3 |
|
|
|
4 |
namespace CGLA
|
|
|
5 |
{
|
|
|
6 |
/** Use the power method to obtain an eigensolution.
|
|
|
7 |
Given a matrix A, the function returns the number
|
|
|
8 |
of eigensolutions found, and the eigenvectors are
|
|
|
9 |
stored in Q as the rows, and the corresponding
|
|
|
10 |
values are stored in the diagonal of L upon return of
|
|
|
11 |
the function.
|
|
|
12 |
|
|
|
13 |
The so called power method is used to find the dominant
|
|
|
14 |
eigenvalue, and the method of deflation is used to find
|
|
|
15 |
the following values. This restricts this function to
|
|
|
16 |
work only on symmetric matrices.
|
|
|
17 |
|
|
|
18 |
DO NOT CALL THIS FUNCTION WITH AN UNSYMMETRIC MATRIX.
|
|
|
19 |
|
|
|
20 |
The final argument is the number of solutions to find. If only
|
|
|
21 |
a number of solutions are interesting, use this argument to save
|
|
|
22 |
cycles.
|
|
|
23 |
*/
|
|
|
24 |
template <class MT>
|
|
|
25 |
int power_eigensolution(const MT& A, MT& Q, MT& L, int max_sol=1000);
|
|
|
26 |
}
|
|
|
27 |
#endif
|