2. Virtual Abstract of Numerical Kernels¶
ChASE relies on a modest number of numerical kernels whose calls execute almost all FLOPs. Because of its simple structure, there would be clear advantages in the separation of the numerical kernels from the algorithm implementation. In ChASE, the linear algebra kernels are separated from the main algorithm through the use of an object-oriented software interface.
2.1. Benefits¶
With the help of the seperation of numerical kernels,
First, ChASE can be easily integrated into existing codes thanks to the relative simplicity of the software interface. For instance, the low-level kernels can be implemented according to an existing distribution of the matrix elements of A so as to avoid the need to re-distribute data;
Second, ChASE can easily exploit existing linear algebra libraries such as BLAS and LAPACK all the way up to GPU-based kernels, and even complex distributed-memory dense linear algebra frameworks such as Elemental.
2.2. Definition of Interface¶
-
template<class T>
class Chase¶ Subclassed by chase::mpi::ChaseMpi< ChaseMpiDLABlaslapack, T >, chase::mpi::ChaseMpi< ChaseMpiDLABlaslapackSeqInplace, T >, chase::mpi::ChaseMpi< MockChaseMpiDLA, T >, chase::PerformanceDecoratorChase< T >, chase::mpi::ChaseMpi< MF, T >
Public Functions
-
virtual void Shift(T c, bool isunshift = false) = 0¶
This member function shifts the diagonal of matrix
Awith a shift valuec.- Parameters:
c – the shift value on the diagonal of matrix
A.
-
virtual void HEMM(std::size_t nev, T alpha, T beta, std::size_t offset) = 0¶
This member function computes \(V1 = alpha * H*V2 + beta * V1\) or \(V2 = alpha * H'*V1 + beta * V2\). This operation starts with an offset
offsetof column,- Parameters:
block – the number of vectors in
V1andV2for thisHEMMoperation.alpha – a scalar of type
Twhich scalesH*V1or ‘H’*V2`.beta – a scalar of type
Twhich scalesV1orV2, respectively.offset – the offset of column which the
HEMMstarts from.
-
virtual void QR(std::size_t fixednev, Base<T> cond) = 0¶
This member function performs a QR factorization with an explicit construction of the unitary matrix
Q.CholQR is used in default. Optionally, user can decide to use Househoulder QR.
- Parameters:
fixednev – total number of converged eigenpairs before this time QR factorization.
-
virtual void RR(Base<T> *ritzv, std::size_t block) = 0¶
This function performs the Rayleigh-Ritz projection, which projects the eigenproblem to be a small one, then solves the small problem and reconstructs the eigenvectors.
- Parameters:
ritzv – a pointer to the array which stores the computed eigenvalues.
block – the number of non-converged eigenpairs, which determines the size of small eigenproblem.
-
virtual void Resd(Base<T> *ritzv, Base<T> *resd, std::size_t fixednev) = 0¶
This member function computes the residuals of unconverged eigenpairs.
- Parameters:
ritzv – an array stores the eigenvalues.
resid – a pointer to an array which stores the residual for each eigenpairs.
fixednev – number of converged eigenpairs. Thus the number of non-converged one which perform this operation of computing residual is
nev_ + nex_ + fixednev_.
-
virtual void Lanczos(std::size_t m, Base<T> *upperb) = 0¶
It estimates the upper bound of user-interested spectrum by Lanczos eigensolver
- Parameters:
m – the iterative steps for Lanczos eigensolver.
upperb – a pointer to the upper bound estimated by Lanczos eigensolver.
-
virtual void Lanczos(std::size_t M, std::size_t numvec, Base<T> *upperb, Base<T> *ritzv, Base<T> *Tau, Base<T> *ritzV) = 0¶
This member function implements the virtual one declared in Chase class. It estimates the upper bound of user-interested spectrum by Lanczos eigensolver
-
virtual void Swap(std::size_t i, std::size_t j) = 0¶
This function swaps the two columns in a matrix used in the Chebyschev filter
- Parameters:
i – one of the column index to be swapped
j – another of the column index to be swapped
-
virtual void Lock(std::size_t new_converged) = 0¶
It locks the
new_convergedeigenvectors, which makeslocked_ += ! new_converged.- Parameters:
new_converged – number of newly converged eigenpairs in the present iterative step.
-
virtual bool checkSymmetryEasy() = 0¶
-
virtual void symOrHermMatrix(char uplo) = 0¶
-
virtual void Start() = 0¶
It indicates the starting point to solve a (new) eigenproblem.
-
virtual void End() = 0¶
It indicates the ending point of solving an eigenproblem.
-
virtual void initVecs(bool random) = 0¶
This member function initializes randomly the vectors when necessary.
- Parameters:
random – a boolean variable indicates if randomness of initial vectors is required.
For solving a sequence of eigenvalue problems, this variable is always
Truewhen solving the first problem.It could be false when the ritzv vectors from previous problem are recycled to speed up the convergence.
-
virtual std::size_t GetN() const = 0¶
Return size of matrix.
-
virtual std::size_t GetNev() = 0¶
Return the number of eigenpairs to be computed.
-
virtual std::size_t GetNex() = 0¶
Return the external searching space size.
-
virtual ChaseConfig<T> &GetConfig() = 0¶
Return a class which contains the configuration parameters.
-
virtual int get_nprocs() = 0¶
Return the number of MPI procs used, it is
1when sequential ChASE is used
-
virtual void Output(std::string str) = 0¶
Print some intermediate infos during the solving procedure.
-
virtual void Shift(T c, bool isunshift = false) = 0¶