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,

  1. 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;

  2. 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::Chase

Subclassed by chase::mpi::ChaseMpi< MF, T >, chase::PerformanceDecoratorChase< T >

Public Functions

void Shift(T c, bool isunshift = false) = 0

This member function shifts the diagonal of matrix A with a shift value c.

Parameters
  • c: the shift value on the diagonal of matrix A.

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 offset of column,

Parameters
  • block: the number of vectors in V1 and V2 for this HEMM operation.

  • alpha: a scalar of type T which scales H*V1 or H*V2`.

  • beta: a scalar of type T which scales V1 or V2, respectively.

  • offset: the offset of column which the HEMM starts from.

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.

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.

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_.

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.

void Lanczos(std::size_t M, std::size_t idx, 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

void LanczosDos(std::size_t idx, std::size_t m, T *ritzVc) = 0
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

void Lock(std::size_t new_converged) = 0

It locks the new_converged eigenvectors, which makes locked_ += new_converged.

Parameters
  • new_converged: number of newly converged eigenpairs in the present iterative step.

void Start() = 0

It indicates the starting point to solve a (new) eigenproblem.

void End() = 0

It indicates the ending point of solving an eigenproblem.

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 True when solving the first problem.

    • It could be false when the ritzv vectors from previous problem are recycled to speed up the convergence.

std::size_t GetN() const = 0

Return size of matrix.

std::size_t GetNev() = 0

Return the number of eigenpairs to be computed.

std::size_t GetNex() = 0

Return the external searching space size.

Base<T> *GetRitzv() = 0

Return the computed ritz values.

Base<T> *GetResid() = 0

Return the residuals of computed ritz pairs.

ChaseConfig<T> &GetConfig() = 0

Return a class which contains the configuration parameters.

int get_nprocs() = 0

Return the number of MPI procs used, it is 1 when sequential ChASE is used