3 #ifndef CH_MATRIX_CLASSES__LANCZPOL_HXX 4 #define CH_MATRIX_CLASSES__LANCZPOL_HXX 15 #ifndef CH_MATRIX_CLASSES__LANCZOS_HXX 95 (*myout)<<
"Lanczos Error: "<<s<<std::endl;
232 {myout=o; print_level=pril;}
236 std::ostream&
save(std::ostream& out)
const;
239 std::istream&
restore(std::istream& in);
std::istream & restore(std::istream &in)
restore the data from in where it was stored by save()
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
Integer nlanczvecs
number of columns of storage matrix X carrying "meaningful" Ritz vectors
Definition: lanczpol.hxx:47
Integer iter
iteration counter for Lanczos restarts (interval guess+computation)
Definition: lanczpol.hxx:53
Integer nmult
number of single vector multiplications with matrix
Definition: lanczpol.hxx:54
Lanczpol()
intialize all to default values
int rotate(Integer neigfound, Integer sbs, Integer l, const Matrix &C, Matrix &X, Matrix &v)
rotate the lanzos vectors to Ritz vectors
int get_lanczosvecs(Matrix &val, Matrix &vecs) const
returns the Lanczos vectors of the last call with their Ritz values
Matrix u
temporary matrix
Definition: lanczpol.hxx:68
double Real
all real numbers in calculations are of this type
Definition: matop.hxx:50
Real errc
error accumulation
Definition: lanczpol.hxx:56
int print_level
level of iteration information that should be displayed
Definition: lanczpol.hxx:89
Integer neigfound
number of eigenvalues known, these are in the first neigfound columns of X
Definition: lanczpol.hxx:51
int err(Integer neigfound, Integer blocksz, const Matrix &X, Matrix &e)
compute norms of deviations of the Ritz vectors from being eigenvectors
CH_Tools::GB_rand randgen
local random number generator
Definition: lanczpol.hxx:81
Matrix w
temporary matrix
Definition: lanczpol.hxx:70
void set_maxmult(Integer mop)
set an upper bound on the number of matrix vector multiplications
Definition: lanczpol.hxx:181
const Lanczosmatrix * bigmatrix
pointer giving the (virtual) input matrix
Definition: lanczpol.hxx:73
int bkqrlanccheb(Integer neigfound, Integer blocksz, Integer s, Matrix &C, Matrix &X, Matrix &e, Matrix &v)
block lanzos multiplication with complete QR orthogonalization and Chebycheff spectral transformation...
void enable_stop_above(Real ub)
allow the algorithm to stop as soon as the maximum Ritz value exceeds the value ub ...
Definition: lanczpol.hxx:192
CH_Tools::Microseconds time_mult_sum
sum over time_mult for all restarts
Definition: lanczpol.hxx:85
int sectn(Matrix &X, Integer neigfound, Integer blocksz, Matrix &C, Matrix &d, Matrix &u, Matrix &v, Real &af)
compute matrix for eigenvalue computation into C
std::ostream * myout
everything is output to *myout, default: myout=&cout (may be 0 for no output)
Definition: lanczpol.hxx:90
void set_relprec(Real relprec)
set relative precision requirement for termination
Definition: lanczpol.hxx:185
Integer maxguessiter
upper bound on number of restarts to guess spectral interval
Definition: lanczpol.hxx:41
Abstract base class for supplying the input matrix for Lanzcosmethods.
Definition: lanczos.hxx:33
Integer choicencheb
user's choice for number of block Chebychev iterations (<0 -> automatic determination) ...
Definition: lanczpol.hxx:43
int blockcheby(Integer col_offset, const Matrix &X, Matrix &v)
apply spectral transformation by using a Chebycheff polynomial on the block multiplications ...
Real scalarcheby(Real xval)
compute the same polynomial as in blockcheby but for the scalar value xval
void set_nchebit(Integer cheb)
set the degree of the Chebycheff polynomial for the spectral transformation
Definition: lanczpol.hxx:187
int dhua(Integer nreig, Integer nproposed, Integer maxmult)
main routine performing the Lancozs iterations
int eigen(Integer neigfound, Integer blocksz, Integer sbsz, Matrix &C, Matrix &d, Matrix &u, Matrix &v, Real &af)
compute eigenvalues of current (block) tridiagonalization
int rotate_extremes(Integer neigfound, Integer sbs, Matrix &d, const Matrix &C, Matrix &X, Matrix &v)
rotate the eigenvectors of the largest and smallest eigenvalues of the tridiagonal matrix...
Real maxval
current approximation of largest eigenvalue
Definition: lanczpol.hxx:59
Integer get_iter() const
returns the number of restarts of the last call
Definition: lanczpol.hxx:208
Integer ncalls
counts number of calls to Lanczpol
Definition: lanczpol.hxx:78
Abstract interface to Lanzcos methods for computing a few extremal eigenvalues given via a Lanczosmat...
Definition: lanczos.hxx:53
Integer choicenbmult
user's choice for number of block multiplications (<0 -> automatic determination, min 6) ...
Definition: lanczpol.hxx:45
Integer maxiter
upper bound on number of restarts
Definition: lanczpol.hxx:40
void set_retlanvecs(Integer nl)
set an upper bound on the number of vectors returned in get_lanczosvecs()
Definition: lanczpol.hxx:197
int random(Matrix &X, Integer j)
assign a random vector to column j of X
int get_err() const
returns the error code of the last call
Definition: lanczpol.hxx:206
int stop_above
1 if algorithm is to stop after upper bound is exceeded
Definition: lanczpol.hxx:75
Integer guessmult
number of matrix vector multiplications to guess interval
Definition: lanczpol.hxx:42
Matrix C
X^tAX, intermediate eigenvalue computations, orthogonalizations, etc.
Definition: lanczpol.hxx:64
Integer maxop
upper bound on matrix vector multiplications
Definition: lanczpol.hxx:39
int ierr
error return code
Definition: lanczpol.hxx:38
CH_Tools::Clock myclock
for time measurements
Definition: lanczpol.hxx:83
Matrix Classes and Linear Algebra. See Matrix Classes (namespace CH_Matrix_Classes) for a quick intro...
Definition: PSCOracle.hxx:20
int cnvtst(Integer neigfound, Integer blocksz, Real &errc, Real eps, const Matrix &d, const Matrix &e, Integer &nconv)
check convergence of maximum Ritz value/vector
Real polval
the Chebychef polynomial will have this value at maxval
Definition: lanczpol.hxx:61
void error(const char *s)
output of error messages
Definition: lanczpol.hxx:93
Real eps
relative precision
Definition: lanczpol.hxx:57
Real upper_bound
stop if current maximum Ritz value exceeds this value
Definition: lanczpol.hxx:76
Header declaring the abstract classes CH_Matrix_Classes::Lanczosmatrix and CH_Matrix_Classes::Lanczos...
Real get_relprec(void)
returns current relative precision requirement
Definition: lanczpol.hxx:203
int bklanc(Integer neigfound, Integer blocksz, Integer s, const Matrix &d, Matrix &C, Matrix &X, Matrix &e, Matrix &u, Matrix &v)
block lanzos multiplication without Chebycheff spectral transformation
Matrix class for real values of type Real
Definition: matrix.hxx:74
int bkqrlanc(Integer neigfound, Integer blocksz, Integer s, const Matrix &d, Matrix &C, Matrix &X, Matrix &e, Matrix &u, Matrix &v)
block lanzos multiplication, with complete QR orthogonalization, without Chebycheff spectral transfor...
Integer blocksz
working block of lanczos vectors X(:,neigfound:neigfound+blocksz-1)
Definition: lanczpol.hxx:52
Integer get_nmult() const
returns the number of matrix-vector multiplications of the last call
Definition: lanczpol.hxx:210
Integer mymaxj
maximum amount of storage (columns) provided in X and C
Definition: lanczpol.hxx:79
CH_Tools::Microseconds time_sum
time spent in this call to compute()
Definition: lanczpol.hxx:87
void set_nblockmult(Integer nb)
set maximum number of block multiplications within one restart
Definition: lanczpol.hxx:189
All derived classes share a common Memarray memory manager, which is generated with the first user an...
Definition: memarray.hxx:117
void disable_stop_above()
do not allow premature termination as in enable_stop_above()
Definition: lanczpol.hxx:194
A Lanczos method allowing spectral transformation by Chebycheff polynomials and premature termination...
Definition: lanczpol.hxx:35
Real minval
current approximation of smallest eigenvalue
Definition: lanczpol.hxx:60
void set_maxiter(Integer mi)
set an upper bpound on the number of restarts
Definition: lanczpol.hxx:183
Matrix v
temporary matrix
Definition: lanczpol.hxx:69
int compute(const Lanczosmatrix *bigmat, Matrix &eigval, Matrix &eigvec, Integer nreig, Integer in_blocksz=0, Integer maxcol=0)
the main routine: compute the nreig maximum eigenvalues of the matrix specified by bigmat ...
CH_Tools::Microseconds time_iter
time spent in last lanczos iteration
Definition: lanczpol.hxx:86
Integer nblockmult
number of blockmultiplications in one restart
Definition: lanczpol.hxx:46
Integer nchebit
number of block Chebychev iterations within one iteration
Definition: lanczpol.hxx:44
Header declaring and (inline) implementing the classes CH_Tools::Microseconds and CH_Tools::Clock as ...
int bklanccheb(Integer neigfound, Integer blocksz, Integer s, Matrix &C, Matrix &X, Matrix &e, Matrix &v)
block lanzos multiplication with Chebycheff spectral transformation
Integer retlanvecs
user's choice for number of returend Ritz vectors (<0 -> nlanczvecs)
Definition: lanczpol.hxx:48
Matrix d
diagonals (Ritz values)
Definition: lanczpol.hxx:65
void set_out(std::ostream *o=0, int pril=1)
set output stream and level of detail of log output (for debugging)
Definition: lanczpol.hxx:231
Matrix Xqr
for complete orthogonalization with Householder QR
Definition: lanczpol.hxx:67
~Lanczpol()
destructor, nothing particular
int guess_extremes(Integer nproposed)
compute a guess for minimum and maximum eigenvalue
std::ostream & save(std::ostream &out) const
save all data in out so that the current state can be recovered completely by restore() ...
Real mcheps
machine precision (computed in constructor)
Definition: lanczpol.hxx:58
Matrix minvec
temporary matrix for guessing minimal eigenvalue
Definition: lanczpol.hxx:71
int tred2(Integer n, const Matrix &C, Matrix &u, Matrix &v, Matrix &Z)
tridiagonalize a symmetric blockdiagonal matrix
Matrix e
error bounds
Definition: lanczpol.hxx:66
void set_mineig(Real ie)
set a guess on the value of the smallest
Definition: lanczpol.hxx:179
Matrix X
provides storage for the Lanczos vectors during computation
Definition: lanczpol.hxx:63
CH_Tools::Microseconds time_mult
for each restart, the time spent in lanczosmult
Definition: lanczpol.hxx:84
int tql2(Integer n, Matrix &u, Matrix &v, Matrix &Z)
compute the eigenvalues of a tridiagonal matrix
Integer orthog(Integer offset, Integer blocksz, Matrix &X, Matrix &B)
orthonormalize columns X(:,offset:offset+l_blocksz-1) to all previous columns