28 for (
int i = 0; i <
n_kr; i++) {
37 errorQuda(
"Only real spectrum type (LR or SR) can be passed to the TR Lanczos solver");
43 void TRLM::operator()(std::vector<ColorSpinorField *> &kSpace, std::vector<Complex> &evals)
73 double mat_norm = 0.0;
97 if (fabs(
alpha[i]) > mat_norm) mat_norm = fabs(
alpha[i]);
147 for (
int i = 0; i <
n_kr; i++) {
167 errorQuda(
"TRLM failed to compute the requested %d vectors with a %d search space and %d Krylov space in %d "
168 "restart steps. Exiting.",
171 warningQuda(
"TRLM failed to compute the requested %d vectors with a %d search space and %d Krylov space in %d "
172 "restart steps. Continuing with current lanczos factorisation.",
177 printfQuda(
"TRLM computed the requested %d vectors in %d restart steps and %d OP*x operations.\n",
n_conv,
221 std::vector<ColorSpinorField *> r_ {
r[0]};
222 std::vector<double> beta_;
223 beta_.reserve(j -
start);
224 std::vector<ColorSpinorField *> v_;
225 v_.reserve(j -
start);
226 for (
int i =
start; i < j; i++) {
227 beta_.push_back(-
beta[i]);
283 MatrixXd A = MatrixXd::Zero(
dim,
dim);
297 for (
int i = 0; i <
dim; i++) {
303 for (
int i = 0; i < arrow_pos; i++) {
310 for (
int i = arrow_pos; i <
dim - 1; i++) {
318 SelfAdjointEigenSolver<MatrixXd> eigensolver;
319 eigensolver.compute(A);
322 for (
int i = 0; i <
dim; i++)
323 for (
int j = 0; j <
dim; j++)
ritz_mat[
dim * i + j] = eigensolver.eigenvectors().col(i)[j];
325 for (
int i = 0; i <
dim; i++) {
341 int offset =
n_kr + 1;
346 for (
int j = 0; j <
dim; j++) {
void blockOrthogonalize(std::vector< ColorSpinorField * > v, std::vector< ColorSpinorField * > &r, int j)
Orthogonalise input vectors r against vector space v using block-BLAS.
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 prepareInitialGuess(std::vector< ColorSpinorField * > &kSpace)
Check for an initial guess. If none present, populate with rands, then orthonormalise.
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 queryPrec(const QudaPrecision prec)
Query the eigensolver precision to stdout.
void prepareKrylovSpace(std::vector< ColorSpinorField * > &kSpace, std::vector< Complex > &evals)
Extend the Krylov space.
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.
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
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.
bool isRunning(QudaProfileType idx)
void mat(void *out, void **link, void *in, int dagger_bit, int mu, QudaPrecision sPrecision, QudaPrecision gPrecision)
#define safe_malloc(size)
void zero(ColorSpinorField &a)
double norm2(const ColorSpinorField &a)
double reDotProduct(ColorSpinorField &x, ColorSpinorField &y)
void axpy(double a, ColorSpinorField &x, ColorSpinorField &y)
void start()
Start profiling.
void saveTuneCache(bool error=false)
__host__ __device__ ValueType sqrt(ValueType x)
QudaEigSpectrumType spectrum
QudaBoolean require_convergence
DEVICEHOST void swap(Real &a, Real &b)
QudaVerbosity getVerbosity()