16 using range = std::pair<int, int>;
52 std::vector<ColorSpinorField *>
r;
83 virtual void operator()(std::vector<ColorSpinorField *> &kSpace, std::vector<Complex> &evals) = 0;
112 void prepareKrylovSpace(std::vector<ColorSpinorField *> &kSpace, std::vector<Complex> &evals);
137 void cleanUpEigensolver(std::vector<ColorSpinorField *> &kSpace, std::vector<Complex> &evals);
174 void blockOrthogonalize(std::vector<ColorSpinorField *> v, std::vector<ColorSpinorField *> &
r,
int j);
190 bool orthoCheck(std::vector<ColorSpinorField *> v,
int j);
202 void rotateVecs(std::vector<ColorSpinorField *> &kSpace,
const double *rot_array,
const int offset,
const int dim,
224 void permuteVecs(std::vector<ColorSpinorField *> &kSpace,
int *
mat,
int size);
239 void blockRotate(std::vector<ColorSpinorField *> &kSpace,
double *array,
int rank,
const range &i,
const range &j,
256 const range &j,
blockType b_type,
int offset);
265 void blockReset(std::vector<ColorSpinorField *> &kSpace,
int js,
int je,
int offset);
275 void deflate(std::vector<ColorSpinorField *> &sol,
const std::vector<ColorSpinorField *> &src,
276 const std::vector<ColorSpinorField *> &evecs,
const std::vector<Complex> &evals,
277 bool accumulate =
false)
const;
289 const std::vector<Complex> &evals,
bool accumulate =
false)
298 std::vector<ColorSpinorField *> src_ {src_tmp};
299 std::vector<ColorSpinorField *> sol_ {&sol};
300 deflate(sol_, src_, evecs, evals, accumulate);
312 void deflateSVD(std::vector<ColorSpinorField *> &sol,
const std::vector<ColorSpinorField *> &vec,
313 const std::vector<ColorSpinorField *> &evecs,
const std::vector<Complex> &evals,
314 bool accumulate =
false)
const;
326 const std::vector<Complex> &evals,
bool accumulate =
false)
335 std::vector<ColorSpinorField *> src_ {src_tmp};
336 std::vector<ColorSpinorField *> sol_ {&sol};
337 deflateSVD(sol_, src_, evecs, evals, accumulate);
455 void operator()(std::vector<ColorSpinorField *> &kSpace, std::vector<Complex> &evals);
462 void lanczosStep(std::vector<ColorSpinorField *> v,
int j);
468 void reorder(std::vector<ColorSpinorField *> &kSpace);
522 void operator()(std::vector<ColorSpinorField *> &kSpace, std::vector<Complex> &evals);
585 void operator()(std::vector<ColorSpinorField *> &kSpace, std::vector<Complex> &evals);
594 void arnoldiStep(std::vector<ColorSpinorField *> &v, std::vector<ColorSpinorField *> &
r,
double &beta,
int j);
608 void rotateBasis(std::vector<ColorSpinorField *> &v,
int keep);
615 void qrShifts(
const std::vector<Complex> evals,
const int num_shifts);
631 void reorder(std::vector<ColorSpinorField *> &kSpace, std::vector<Complex> &evals,
650 void arpack_solve(std::vector<ColorSpinorField *> &h_evecs, std::vector<Complex> &h_evals,
const DiracMatrix &
mat,
Block Thick Restarted Lanczos Method.
std::vector< Complex > block_ritz_mat
void operator()(std::vector< ColorSpinorField * > &kSpace, std::vector< Complex > &evals)
Compute eigenpairs.
void eigensolveFromBlockArrowMat()
Get the eigendecomposition from the current block arrow matrix.
void computeBlockKeptRitz(std::vector< ColorSpinorField * > &kSpace)
Rotate the Ritz vectors usinng the arrow matrix eigendecomposition Uses a complex ritz matrix.
BLKTRLM(const DiracMatrix &mat, QudaEigParam *eig_param, TimeProfile &profile)
Constructor for Thick Restarted Eigensolver class.
void updateBlockBeta(int k, int arrow_offset)
Accumulate the R products of QR into the block beta array.
virtual ~BLKTRLM()
Destructor for Thick Restarted Eigensolver class.
void blockLanczosStep(std::vector< ColorSpinorField * > v, int j)
block lanczos step: extends the Krylov space in block step
static ColorSpinorField * Create(const ColorSpinorParam ¶m)
virtual void operator()(std::vector< ColorSpinorField * > &kSpace, std::vector< Complex > &evals)=0
Computes the eigen decomposition for the operator passed to create.
void blockOrthogonalize(std::vector< ColorSpinorField * > v, std::vector< ColorSpinorField * > &r, int j)
Orthogonalise input vectors r against vector space v using block-BLAS.
void blockReset(std::vector< ColorSpinorField * > &kSpace, int js, int je, int offset)
Copy temp part of kSpace, zero out for next use.
void matVec(const DiracMatrix &mat, ColorSpinorField &out, const ColorSpinorField &in)
Applies the specified matVec operation: M, Mdag, MMdag, MdagM.
void blockRotate(std::vector< ColorSpinorField * > &kSpace, double *array, int rank, const range &i, const range &j, blockType b_type)
Rotate part of kSpace.
bool orthoCheck(std::vector< ColorSpinorField * > v, int j)
Check orthonormality of input vector space v.
void deflateSVD(ColorSpinorField &sol, const ColorSpinorField &src, const std::vector< ColorSpinorField * > &evecs, const std::vector< Complex > &evals, bool accumulate=false)
Deflate a a given source vector with a given with a set of left and right singular vectors This is a ...
void rotateVecs(std::vector< ColorSpinorField * > &kSpace, const double *rot_array, const int offset, const int dim, const int keep, const int locked, TimeProfile &profile)
Rotate the Krylov space.
void deflate(std::vector< ColorSpinorField * > &sol, const std::vector< ColorSpinorField * > &src, const std::vector< ColorSpinorField * > &evecs, const std::vector< Complex > &evals, bool accumulate=false) const
Deflate a set of source vectors with a given eigenspace.
void prepareInitialGuess(std::vector< ColorSpinorField * > &kSpace)
Check for an initial guess. If none present, populate with rands, then orthonormalise.
void computeEvals(const DiracMatrix &mat, std::vector< ColorSpinorField * > &evecs, std::vector< Complex > &evals)
Compute eigenvalues and their residiua. This variant compute the number of converged eigenvalues.
void deflateSVD(std::vector< ColorSpinorField * > &sol, const std::vector< ColorSpinorField * > &vec, const std::vector< ColorSpinorField * > &evecs, const std::vector< Complex > &evals, bool accumulate=false) const
Deflate a set of source vectors with a set of left and right singular vectors.
void sortArrays(QudaEigSpectrumType spec_type, int n, std::vector< Complex > &x, std::vector< Complex > &y)
Sort array the first n elements of x according to spec_type, y comes along for the ride.
EigenSolver(const DiracMatrix &mat, QudaEigParam *eig_param, TimeProfile &profile)
Constructor for base Eigensolver class.
void orthonormalizeMGS(std::vector< ColorSpinorField * > &v, int j)
Orthonormalise input vector space v using Modified Gram-Schmidt.
virtual bool hermitian()=0
std::vector< ColorSpinorField * > r
void checkChebyOpMax(const DiracMatrix &mat, std::vector< ColorSpinorField * > &kSpace)
Check for a maximum of the Chebyshev operator.
double setEpsilon(const QudaPrecision prec)
Set the epsilon parameter.
void computeEvals(const DiracMatrix &mat, std::vector< ColorSpinorField * > &evecs, std::vector< Complex > &evals, int size)
Compute eigenvalues and their residiua.
void computeSVD(const DiracMatrix &mat, std::vector< ColorSpinorField * > &evecs, std::vector< Complex > &evals)
Computes Left/Right SVD from pre computed Right/Left.
void rotateVecsComplex(std::vector< ColorSpinorField * > &kSpace, const Complex *rot_array, const int offset, const int dim, const int keep, const int locked, TimeProfile &profile)
Rotate the Krylov space.
void permuteVecs(std::vector< ColorSpinorField * > &kSpace, int *mat, int size)
Permute the vector space using the permutation matrix.
double estimateChebyOpMax(const DiracMatrix &mat, ColorSpinorField &out, ColorSpinorField &in)
Estimate the spectral radius of the operator for the max value of the Chebyshev polynomial.
void queryPrec(const QudaPrecision prec)
Query the eigensolver precision to stdout.
static EigenSolver * create(QudaEigParam *eig_param, const DiracMatrix &mat, TimeProfile &profile)
Creates the eigensolver using the parameters given and the matrix.
void prepareKrylovSpace(std::vector< ColorSpinorField * > &kSpace, std::vector< Complex > &evals)
Extend the Krylov space.
void deflate(ColorSpinorField &sol, const ColorSpinorField &src, const std::vector< ColorSpinorField * > &evecs, const std::vector< Complex > &evals, bool accumulate=false)
Deflate a given source vector with a given eigenspace. This is a wrapper variant for a single source ...
void loadFromFile(const DiracMatrix &mat, std::vector< ColorSpinorField * > &eig_vecs, std::vector< Complex > &evals)
Load and check eigenpairs from file.
void cleanUpEigensolver(std::vector< ColorSpinorField * > &kSpace, std::vector< Complex > &evals)
Release memory, save eigenvectors, resize the Krylov space to its original dimension.
std::vector< ColorSpinorField * > d_vecs_tmp
void blockRotateComplex(std::vector< ColorSpinorField * > &kSpace, Complex *array, int rank, const range &i, const range &j, blockType b_type, int offset)
Rotate part of kSpace.
void printEigensolverSetup()
Dump the eigensolver parameters to stdout.
void chebyOp(const DiracMatrix &mat, ColorSpinorField &out, const ColorSpinorField &in)
Promoted the specified matVec operation: M, Mdag, MMdag, MdagM to a Chebyshev polynomial.
std::vector< double > residua
Implicitly Restarted Arnoldi Method.
void rotateBasis(std::vector< ColorSpinorField * > &v, int keep)
Rotate the Krylov space.
IRAM(const DiracMatrix &mat, QudaEigParam *eig_param, TimeProfile &profile)
Constructor for Thick Restarted Eigensolver class.
virtual ~IRAM()
Destructor for Thick Restarted Eigensolver class.
void qrIteration(Complex **Q, Complex **R)
Apply One step of the the QR algorithm.
void eigensolveFromUpperHess(std::vector< Complex > &evals, const double beta)
Get the eigendecomposition from the upper Hessenberg matrix via QR.
void arnoldiStep(std::vector< ColorSpinorField * > &v, std::vector< ColorSpinorField * > &r, double &beta, int j)
Arnoldi step: extends the Krylov space by one vector.
void reorder(std::vector< ColorSpinorField * > &kSpace, std::vector< Complex > &evals, const QudaEigSpectrumType spec_type)
Reorder the Krylov space and eigenvalues.
void operator()(std::vector< ColorSpinorField * > &kSpace, std::vector< Complex > &evals)
Compute eigenpairs.
void qrShifts(const std::vector< Complex > evals, const int num_shifts)
Apply shifts to the upper Hessenberg matrix via QR decomposition.
QudaPrecision Precision() const
Thick Restarted Lanczos Method.
std::vector< double > ritz_mat
void eigensolveFromArrowMat()
Get the eigendecomposition from the arrow matrix.
void lanczosStep(std::vector< ColorSpinorField * > v, int j)
Lanczos step: extends the Krylov space.
void computeKeptRitz(std::vector< ColorSpinorField * > &kSpace)
Rotate the Ritz vectors usinng the arrow matrix eigendecomposition.
void operator()(std::vector< ColorSpinorField * > &kSpace, std::vector< Complex > &evals)
Compute eigenpairs.
virtual ~TRLM()
Destructor for Thick Restarted Eigensolver class.
TRLM(const DiracMatrix &mat, QudaEigParam *eig_param, TimeProfile &profile)
Constructor for Thick Restarted Eigensolver class.
void reorder(std::vector< ColorSpinorField * > &kSpace)
Reorder the Krylov space by eigenvalue.
void mat(void *out, void **link, void *in, int dagger_bit, int mu, QudaPrecision sPrecision, QudaPrecision gPrecision)
enum QudaPrecision_s QudaPrecision
enum QudaEigSpectrumType_s QudaEigSpectrumType
void copy(ColorSpinorField &dst, const ColorSpinorField &src)
void arpack_solve(std::vector< ColorSpinorField * > &h_evecs, std::vector< Complex > &h_evals, const DiracMatrix &mat, QudaEigParam *eig_param, TimeProfile &profile)
The QUDA interface function. One passes two allocated arrays to hold the the eigenmode data,...
std::complex< double > Complex
Main header file for the QUDA library.