|
FILTLAN 1.0a
|
00001 00034 #ifndef FILTLAN_H 00035 #define FILTLAN_H 00036 00041 #include "laneig.h" 00042 #include "polyfilt.h" 00043 00044 #ifdef USE_NAMESPACE 00045 using namespace MATKIT; 00046 namespace MATKIT { 00047 #endif 00048 00049 class Vector; 00050 class Matrix; 00051 class SparseMatrix; 00052 00053 #ifdef USE_NAMESPACE 00054 } // end of namespace MATKIT 00055 #endif 00056 00057 00063 00064 // an instance of this class, taken by FilteredLanczosEigenSolver(), is a collection of options for the filtered Lanczos procedure to solve symmetric eigenvalue problems 00065 struct FilteredLanczosOptions: public LanczosOptions { 00067 00071 // this parameter tells whether eigenvalues are wanted or not (default true) 00072 // note that the filtered Lanczos procedure computes the eigenvectors first 00073 // the computation of eigenvalues is unnecessary if only the invariant subspace is required 00074 // note that the option wantEigVec inherited from LanczosOptions is no longer effective in the filtered Lanczos procedure 00075 bool wantEigVal; 00077 00084 // neigWanted is the number of eigenvalues/eigenvectors desired 00085 // if nev == 0 is given (the default), then it means that all eigenvalues/eigenvectors in the requested interval are to be sought 00086 // otherwise, let nev be the number of eigenvalues in the requested interval 00087 // if nev <= neigWanted, then the iteration continues until all nev eigenvalues/eigenvectors in the requested interval converge 00088 // if nev > neigWanted, then the iteration stops when neigWanted eigenvalues in the requested interval converge 00089 mkIndex neigWanted; 00091 00095 // number of Lanczos iterations to determine an interval which (tightly) contains all eigenvalues (default 30) 00096 // the filtered Lanczos procedure requires an interval which (tightly) contains all eigenvalues 00097 // if it is not provided, then we use a standard Lanczos procedure with numIterForEigenRange iterations to compute one 00098 // the higher the numIterForEigenRange, the tighter the interval 00099 mkIndex numIterForEigenRange; 00100 00102 // a collection of options to determine the intervals 00103 IntervalOptions intervalOpts; 00104 00106 // a constructor to set default options 00107 FilteredLanczosOptions() { 00108 wantEigVal = true; // filtered Lanczos computes eigenvectors first; 00109 // if only the invariant subspace is wanted, then the computation of eigenvalues is not required, 00110 // in which case wantEigVal can be set false 00111 neigWanted = 0; // means to compute all eigenvalues in the given range 00112 // if neigWanted > 0, then quit the Lanczos loop when neigWanted eigenvalues are found in the specified range, 00113 // or when all ( < neigWanted ) eigenvalues are found in the specified range 00114 numIterForEigenRange = 30; // number of Lanczos iterations to determine the eigen-range 00115 extraIter = 20; // laneig has the default extraIter==60 00116 // filtlan requires less extraIter for comparable accuracy of eigenvalues 00117 defaultMinIterFactor = 2; // likewise, filtlan can have less defaultMinIterFactor, 00118 defaultMaxIterFactor = 30; // and also defaultMaxIterFactor than laneig 00119 } 00120 }; 00121 00123 // FilteredLanczosEigenSolver() returns an instance of this class which gives the information of the filtered Lanczos procedure 00124 struct FilteredLanczosInfo: public LanczosInfo { 00126 // information about the Lanczos procedure to determine the range of eigenvalues by approximating the largest eigenvalue and the smallest eigenvalue, if this range is not provided 00127 LanczosInfo forEigenRangeInfo; 00129 // CPU time (in seconds) to determine the range of eigenvalues, if this range is not provided 00130 Real forEigenRangeCpuTime; 00132 00134 // the range of eigenvalues is partitioned into intervals which determine the base filter approximated by a polynomial filter 00135 // the j-th interval is [intervals(j),intervals(j+1)) 00136 Vector intervals; 00137 }; 00138 00139 00141 00164 // this routine computes the eigenvalues in the requested window and the corresponding eigenvectors 00165 // the window can contain the largest or smallest eigenvalues, in which case the requested are the extreme eigenvalues 00166 // the window can also be well inside the range of the spectrum, in which case it is often referred to as an interior eigenvalue problem 00167 // eigVal is a vector which contains the computed eigenvalues (if opts.wantEigVal==true) 00168 // eigVec is a matrix whose columns are computed eigenvectors 00169 // more precisely, eigVec(:,j) is the eigenvector corresponding to the eigenvalue eigVal(j) 00170 // S is the sparse matrix whose eigenvalues / eigenvectors are to be sought 00171 // frame is a vector of 2 or 4 elements 00172 // if frame consists of 2 elements, then [frame(1),frame(2)] is the interval in which the eigenvalues are sought 00173 // if frame consists of 4 elements, then [frame(2),frame(3)] is the interval in which the eigenvalues are sought, and 00174 // [frame(1),frame(4)] is the interval which (tightly) contains all eigenvalues 00175 // in the former case, an interval which contains (tightly) all eigenvalues is not given, and will be determined by a standard Lanczos procedure 00176 // polyDegree is the degree of s(z), with z*s(z) the polynomial filter 00177 // baseDegree is the left-and-right degree of the base filter for each interval 00178 // opts is a collection of options for the filtered Lanczos procedure 00179 // the return FilteredLanczosInfo gives the information of the filtered Lanczos procedure 00180 FilteredLanczosInfo FilteredLanczosEigenSolver(Vector &eigVal, Matrix &eigVec, 00181 const SparseMatrix &S, Vector &frame, 00182 mkIndex polyDegree, mkIndex baseDegree, FilteredLanczosOptions &opts); 00183 // end of group_filtlan 00185 00186 00187 #endif
1.7.3