FILTLAN  1.0a
symtrieig.h
Go to the documentation of this file.
1 #ifndef SYMTRIEIG_H
2 #define SYMTRIEIG_H
3 
9 // routines for symmetric eigenvalue problems, invoking LAPACK routine sstev_ (single precision) or dstev_ (double precision)
10 
11 #include <iostream> // for ostream
12 #include "matkitdef.h"
13 
14 #ifdef USE_NAMESPACE
15 using namespace MATKIT;
16 namespace MATKIT {
17 #endif
18 
19 class Vector;
20 class Matrix;
21 
22 #ifdef USE_NAMESPACE
23 } // end of namespace MATKIT
24 #endif
25 
26 
27 
33 
47 // compute all eigenvalues (but not eigenvectors) of a symmetric tridiagonal matrix
48 // n is the dimension of the symmetric tridiagonal matrix
49 // diag[],sdiag[] define the symmetric tridiagonal matrix:
50 // the diagonal elements are diag[0,...,n-1] in order and the subdiagonal elements are sdiag[0,...,n-2] in order
51 // eigVal is the output vector of length n containing all eigenvalues in ascending order
52 // the return value is the flag returned by the LAPACK routine dstev_() (if Real is double) or stev_() (if Real is float)
53 int SymmetricTridiagoanlEigenSolver(Vector &eigVal, mkIndex n, const Real *diag, const Real *sdiag);
54 
56 
70 // compute all eigenvalues and eigenvectors of a symmetric tridiagonal matrix
71 // n is the dimension of the symmatrix tridiagonal matrix
72 // diag[],sdiag[] define the symmetric tridiagonal matrix:
73 // the diagonal elements are diag[0,...,n-1] in order and the subdiagonal elements are sdiag[0,...,n-2] in order
74 // eigVal is the output vector of length n containing all eigenvalues in ascending order
75 // eigVec is the output n-by-n matrix with columns as eigenvectors, in the order as elements in eigVal
76 // the return value is the flag returned by the LAPACK routine dstev_() (if Real is double) or stev_() (if Real is float)
77 int SymmetricTridiagoanlEigenSolver(Vector &eigVal, Matrix &eigVec, mkIndex n, const Real *diag, const Real *sdiag);
78 
80 
92 // print out an error message to std::ostream outerr if info!=0 which signifies an error that occurred in the LAPACK routine xSTEV
93 // outerr is an std::ostream for printing out the error message when info!=0
94 // info is the flag returned from the LAPACK routine dstev_() (if Real is double) or sstev_() (if Real is float)
95 // = 0: successful exit (nothing will be printed)
96 // < 0: if info = -i, the i-th argument had an illegal value
97 // > 0: if info = i, the algorithm failed to converge; i off-diagonal elements did not converge to zero
98 // n is the dimension of the symmetric tridiagonal matrix; this information will also be printed out if n is provided (i.e. n!=0)
99 void reportTroubleIfAny(std::ostream &outerr, int info, mkIndex n=0);
100  // end of group_symtrieig
102 
103 
104 #endif
int SymmetricTridiagoanlEigenSolver(Vector &eigVal, mkIndex n, const Real *diag, const Real *sdiag)
Compute all eigenvalues (but not eigenvectors) of a symmetric tridiagonal matrix T. This function invokes the LAPACK routine dstev_() (if Real is double) or stev_() (if Real is float).
void reportTroubleIfAny(std::ostream &outerr, int info, mkIndex n=0)
Print out an error message to std::ostream outerr if info 0 which signifies an error that occurred i...