|
FILTLAN 1.0a
|
00001 #ifndef SYMTRIEIG_H 00002 #define SYMTRIEIG_H 00003 00009 // routines for symmetric eigenvalue problems, invoking LAPACK routine sstev_ (single precision) or dstev_ (double precision) 00010 00011 #include <iostream> // for ostream 00012 #include "matkitdef.h" 00013 00014 #ifdef USE_NAMESPACE 00015 using namespace MATKIT; 00016 namespace MATKIT { 00017 #endif 00018 00019 class Vector; 00020 class Matrix; 00021 00022 #ifdef USE_NAMESPACE 00023 } // end of namespace MATKIT 00024 #endif 00025 00026 00027 00033 00034 00047 // compute all eigenvalues (but not eigenvectors) of a symmetric tridiagonal matrix 00048 // n is the dimension of the symmetric tridiagonal matrix 00049 // diag[],sdiag[] define the symmetric tridiagonal matrix: 00050 // the diagonal elements are diag[0,...,n-1] in order and the subdiagonal elements are sdiag[0,...,n-2] in order 00051 // eigVal is the output vector of length n containing all eigenvalues in ascending order 00052 // the return value is the flag returned by the LAPACK routine dstev_() (if Real is double) or stev_() (if Real is float) 00053 int SymmetricTridiagoanlEigenSolver(Vector &eigVal, mkIndex n, const Real *diag, const Real *sdiag); 00054 00056 00070 // compute all eigenvalues and eigenvectors of a symmetric tridiagonal matrix 00071 // n is the dimension of the symmatrix tridiagonal matrix 00072 // diag[],sdiag[] define the symmetric tridiagonal matrix: 00073 // the diagonal elements are diag[0,...,n-1] in order and the subdiagonal elements are sdiag[0,...,n-2] in order 00074 // eigVal is the output vector of length n containing all eigenvalues in ascending order 00075 // eigVec is the output n-by-n matrix with columns as eigenvectors, in the order as elements in eigVal 00076 // the return value is the flag returned by the LAPACK routine dstev_() (if Real is double) or stev_() (if Real is float) 00077 int SymmetricTridiagoanlEigenSolver(Vector &eigVal, Matrix &eigVec, mkIndex n, const Real *diag, const Real *sdiag); 00078 00080 00092 // print out an error message to std::ostream outerr if info!=0 which signifies an error that occurred in the LAPACK routine xSTEV 00093 // outerr is an std::ostream for printing out the error message when info!=0 00094 // info is the flag returned from the LAPACK routine dstev_() (if Real is double) or sstev_() (if Real is float) 00095 // = 0: successful exit (nothing will be printed) 00096 // < 0: if info = -i, the i-th argument had an illegal value 00097 // > 0: if info = i, the algorithm failed to converge; i off-diagonal elements did not converge to zero 00098 // n is the dimension of the symmetric tridiagonal matrix; this information will also be printed out if n is provided (i.e. n!=0) 00099 void reportTroubleIfAny(std::ostream &outerr, int info, mkIndex n=0); 00100 // end of group_symtrieig 00102 00103 00104 #endif
1.7.3