ConicBundle
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CH_Matrix_Classes::LanczMaxEig Class Reference

A Lanczos method allowing spectral transformation by Chebycheff polynomials and premature termination. More...

#include <LanczMaxEig.hxx>

Inheritance diagram for CH_Matrix_Classes::LanczMaxEig:
CH_Matrix_Classes::Lanczos CH_Matrix_Classes::Memarrayuser

Public Member Functions

 LanczMaxEig ()
 intialize all to default values
 
 ~LanczMaxEig ()
 destructor, nothing particular
 
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 More...
 
Set and Get Parameters

There should be no need to set any parameters, default values should be available and reasonable.

void set_mineig (Real ie)
 set a guess on the value of the smallest
 
void set_maxmult (Integer mop)
 set an upper bound on the number of matrix vector multiplications
 
void set_maxiter (Integer mi)
 set an upper bpound on the number of restarts
 
void set_relprec (Real relprec)
 set relative precision requirement for termination
 
void set_nchebit (Integer cheb)
 set the degree of the Chebycheff polynomial for the spectral transformation
 
void set_nblockmult (Integer nb)
 set maximum number of block multiplications within one restart
 
void enable_stop_above (Real ub)
 allow the algorithm to stop as soon as the maximum Ritz value exceeds the value ub
 
void disable_stop_above ()
 do not allow premature termination as in enable_stop_above()
 
void set_retlanvecs (Integer nl)
 set an upper bound on the number of vectors returned in get_lanczosvecs()
 
int get_lanczosvecs (Matrix &val, Matrix &vecs) const
 returns the Lanczos vectors of the last call with their Ritz values
 
Real get_relprec (void)
 returns current relative precision requirement
 
int get_err () const
 returns the error code of the last call
 
Integer get_iter () const
 returns the number of restarts of the last call
 
Integer get_nmult () const
 returns the number of matrix-vector multiplications of the last call
 
Input/Output
void set_out (std::ostream *o=0, int pril=1)
 set output stream and level of detail of log output (for debugging)
 
std::ostream & save (std::ostream &out) const
 save all data in out so that the current state can be recovered completely by restore()
 
std::istream & restore (std::istream &in)
 restore the data from in where it was stored by save()
 
Set and Get Parameters

There should be no need to set any parameters, default values should be available and reasonable.

Input/Output

Private Member Functions

void error (const char *s)
 output of error messages
 
int guess_extremes (Integer nproposed)
 compute a guess for minimum and maximum eigenvalue
 
int dhua (Integer nreig, Integer nproposed, Integer maxmult)
 main routine performing the Lancozs iterations
 
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
 
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 transformation
 
int bklanccheb (Integer neigfound, Integer blocksz, Integer s, Matrix &C, Matrix &X, Matrix &e, Matrix &v)
 block lanzos multiplication with Chebycheff spectral transformation
 
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
 
int err (Integer neigfound, Integer blocksz, const Matrix &X, Matrix &e)
 compute norms of deviations of the Ritz vectors from being eigenvectors
 
int cnvtst (Integer neigfound, Integer blocksz, Real &errc, Real eps, const Matrix &d, const Matrix &e, Indexmatrix &newconv)
 check convergence of maximum Ritz value/vector
 
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 sectn (Matrix &X, Integer neigfound, Integer blocksz, Matrix &C, Matrix &d, Matrix &u, Matrix &v, Real &af)
 compute matrix for eigenvalue computation into C
 
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.
 
int rotate (Integer neigfound, Integer sbs, Integer l, const Matrix &C, Matrix &X, Matrix &v)
 rotate the lanzos vectors to Ritz vectors
 
int resort (Integer neigfound, const Indexmatrix &newconv, Matrix &X, Matrix &d, Matrix &e, Matrix &v)
 rotate the lanzos vectors to Ritz vectors
 
int random (Matrix &X, Integer j)
 assign a random vector to column j of X
 
Integer orthog (Integer offset, Integer blocksz, Matrix &X, Matrix &B)
 orthonormalize columns X(:,offset:offset+l_blocksz-1) to all previous columns
 
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
 
int tred2 (Integer n, const Matrix &C, Matrix &u, Matrix &v, Matrix &Z)
 tridiagonalize a symmetric blockdiagonal matrix
 
int tql2 (Integer n, Matrix &u, Matrix &v, Matrix &Z)
 compute the eigenvalues of a tridiagonal matrix
 

Private Attributes

int ierr
 error return code
 
Integer maxop
 upper bound on matrix vector multiplications
 
Integer maxiter
 upper bound on number of restarts
 
Integer maxguessiter
 upper bound on number of restarts to guess spectral interval
 
Integer guessmult
 number of matrix vector multiplications to guess interval
 
Integer choicencheb
 user's choice for number of block Chebychev iterations (<0 -> automatic determination)
 
Integer nchebit
 number of block Chebychev iterations within one iteration
 
Integer choicenbmult
 user's choice for number of block multiplications (<0 -> automatic determination, min 6)
 
Integer nblockmult
 number of blockmultiplications in one restart
 
Integer nlanczvecs
 number of columns of storage matrix X carrying "meaningful" Ritz vectors
 
Integer retlanvecs
 user's choice for number of returend Ritz vectors (<0 -> nlanczvecs)
 
Integer neigfound
 number of eigenvalues known, these are in the first neigfound columns of X
 
Integer blocksz
 working block of lanczos vectors X(:,neigfound:neigfound+blocksz-1)
 
Integer iter
 iteration counter for Lanczos restarts (interval guess+computation)
 
Integer nmult
 number of single vector multiplications with matrix
 
Real errc
 error accumulation
 
Real eps
 relative precision
 
Real mcheps
 machine precision (computed in constructor)
 
Real maxval
 current approximation of largest eigenvalue
 
Real minval
 current approximation of smallest eigenvalue
 
Real polval
 the Chebychef polynomial will have this value at maxval
 
Matrix X
 provides storage for the Lanczos vectors during computation
 
Matrix C
 X^tAX, intermediate eigenvalue computations, orthogonalizations, etc.
 
Matrix d
 diagonals (Ritz values)
 
Matrix e
 error bounds
 
Matrix Xqr
 for complete orthogonalization with Householder QR
 
Matrix u
 temporary matrix
 
Matrix v
 temporary matrix
 
Matrix w
 temporary matrix
 
Matrix minvec
 temporary matrix for guessing minimal eigenvalue
 
const Lanczosmatrixbigmatrix
 pointer giving the (virtual) input matrix
 
int stop_above
 1 if algorithm is to stop after upper bound is exceeded
 
Real upper_bound
 stop if current maximum Ritz value exceeds this value
 
Integer ncalls
 counts number of calls to LanczMaxEig
 
Integer mymaxj
 maximum amount of storage (columns) provided in X and C
 
CH_Tools::GB_rand randgen
 local random number generator
 
CH_Tools::Clock myclock
 for time measurements
 
CH_Tools::Microseconds time_mult
 for each restart, the time spent in lanczosmult
 
CH_Tools::Microseconds time_mult_sum
 sum over time_mult for all restarts
 
CH_Tools::Microseconds time_iter
 time spent in last lanczos iteration
 
CH_Tools::Microseconds time_sum
 time spent in this call to compute()
 
int print_level
 level of iteration information that should be displayed
 
std::ostream * myout
 everything is output to *myout, default: myout=&cout (may be 0 for no output)
 

Additional Inherited Members

- Protected Member Functions inherited from CH_Matrix_Classes::Memarrayuser
 Memarrayuser ()
 if memarray is NULL, then a new Memarray is generated. In any case the number of users of the Memarray is incremented
 
virtual ~Memarrayuser ()
 the number of users is decremented and the Memarray memory manager is destructed, if the number is zero.
 
- Static Protected Attributes inherited from CH_Matrix_Classes::Memarrayuser
static Memarraymemarray
 pointer to common memory manager for all Memarrayusers, instantiated in memarray.cxx
 

Detailed Description

A Lanczos method allowing spectral transformation by Chebycheff polynomials and premature termination.

The code is a translation and adaptation of a FORTRAN code most likely written by Hua.

Member Function Documentation

◆ compute()

int CH_Matrix_Classes::LanczMaxEig::compute ( const Lanczosmatrix bigmat,
Matrix eigval,
Matrix eigvec,
Integer  nreig,
Integer  in_blocksz = 0,
Integer  maxcol = 0 
)
virtual

the main routine: compute the nreig maximum eigenvalues of the matrix specified by bigmat

Parameters
bigmatthe symmetric matrix
eigvalon output: converged eigenvalues
eigvecon output: eigenvectors to eigval, on input (optional): starting vectors
nreignumber of maximal eigenvalues to be computed
in_blockszsize of a block, if block Lanczos is used
maxcolmaximum number of columns that may be used

Implements CH_Matrix_Classes::Lanczos.

Referenced by get_nmult().


The documentation for this class was generated from the following file: