1 #ifndef SELDON_FILE_EIGENVALUE_SOLVER_HXX
16 template<
class T,
class MatStiff = Matrix<T>,
17 class MatMass = Matrix<
double> >
38 enum {REGULAR_MODE, SHIFTED_MODE, IMAG_SHIFTED_MODE, INVERT_MODE,
39 BUCKLING_MODE, CAYLEY_MODE};
47 enum {SMALL_EIGENVALUES, LARGE_EIGENVALUES, CENTERED_EIGENVALUES};
50 enum {SORTED_REAL, SORTED_IMAG, SORTED_MODULUS};
58 enum {SOLVER_LOBPCG, SOLVER_BKS, SOLVER_BD};
61 enum {ORTHO_DGKS, ORTHO_SVQB};
136 #ifdef SELDON_WITH_MPI
178 #ifdef SELDON_WITH_MPI
179 void SetCommunicator(MPI_Comm& comm_);
180 MPI_Intracomm& GetCommunicator();
206 int type_sort = SORTED_MODULUS);
209 int type_sort = SORTED_MODULUS);
271 template<
class TransA,
class T0>
277 template<
class TransStatus>
280 template<
class TransStatus>
288 template<
class EigenPb,
class Vector1,
class Matrix1,
class T0>
290 Vector1& eigen_values,
291 Vector1& lambda_imag,
292 Matrix1& eigen_vectors,
293 const T0& shiftr,
const T0& shifti);
295 template<
class EigenPb,
class Vector1,
class Matrix1,
class T0>
297 Vector1& eigen_values,
298 Vector1& lambda_imag,
299 Matrix1& eigen_vectors,
300 const complex<T0>& shiftr,
301 const complex<T0>& shifti);
307 template<
class T,
class Storage1,
class Storage2,
308 class Alloc1,
class Alloc2>
312 int type_spectrum,
int type_sort,
313 const T& shift_r,
const T& shift_i);
316 template<
class T,
class Storage1,
class Storage2,
317 class Alloc1,
class Alloc2>
319 Vector<complex<T> >& lambda_i,
322 int type_spectrum,
int type_sort,
323 const complex<T>& shift_r,
const complex<T>& shift_i);
327 template<
class T,
class Prop,
class Storage,
328 class Tmass = double,
class PropM =
Symmetric,
332 Matrix<Tmass, PropM, StorageM> >
353 template<
class TransStatus,
class T0>
356 template<
class TransStatus,
class T0>
359 template<
class TransStatus>
361 Vector<complex<double> >& X);
363 template<
class TransStatus>
365 Vector<complex<double> >& X);
374 const complex<T0>& b,
378 const complex<double>& b,
384 template<
class TransA,
class T0>
394 template<
class T,
class MatStiff,
400 typedef typename MatMass::value_type MassValue;
403 typedef typename ClassComplexType<T>::Tcplx Complexe;
427 template<
class Storage,
class Alloc>
430 template<
class T0,
class T1,
class Prop,
class Storage,
class Alloc>
433 template<
class TransStatus,
class T0>
436 template<
class TransStatus,
class T0>
439 template<
class TransStatus>
441 Vector<complex<double> >& X);
443 template<
class TransStatus>
445 Vector<complex<double> >& X,
double&);
447 template<
class TransStatus>
449 Vector<complex<double> >& X, complex<double>&);
451 template<
class TransStatus>
453 Vector<complex<double> >& X);
455 template<
class TransStatus>
457 Vector<complex<double> >& X,
double&);
459 template<
class TransStatus>
461 Vector<complex<double> >& X, complex<double>&);
470 const complex<T0>& b,
474 const complex<double>& b,
480 template<
class TransA,
class T0>
484 template<
class TransA>
488 template<
class TransA>
490 const Vector<complex<double> >& X,
491 Vector<complex<double> >& Y);
499 template<
class T,
class MatStiff>
502 Matrix<double, Symmetric, ArrayRowSymSparse> >
515 enum {DEFAULT, ARPACK, ANASAZI, FEAST};
517 static int default_solver;
523 template<
class EigenPb,
class Vector1,
class Vector2,
524 class T,
class Prop,
class Storage,
class Alloc3>
525 void GetEigenvaluesEigenvectors(EigenPb& var_eig, Vector1& lambda,
531 #define SELDON_FILE_EIGENVALUE_SOLVER_HXX
bool IsSymmetricProblem() const
returns true if the matrix is symmetric
bool IsHermitianProblem() const
returns true if the matrix is hermitian
void PrintErrorInit() const
prints error of initialization and aborts program
int GetTypeSpectrum() const
returns the spectrum desired (large, small eigenvalues, etc)
computation of a few eigenvalues for dense matrices
int n_
size of the problem
void MltCholeskyMass(const TransStatus &transA, Vector< T0 > &X)
computation of L X or L^T X
void Init(int n)
initialisation of the size of the eigenvalue problem
T shift
shift sigma (if type_spectrum = centered_eigenvalues)
int nb_maximum_iterations
Maximal number of iterations.
Matrix< Tmass, PropM, StorageM > mat_chol
Cholesky factorisation of mass matrix.
list of availables eigenvalue solvers
void ComputeComplexSolution(const TransA &, const Vector< double > &X, Vector< double > &Y)
solves (a M + b K) Y = X when a and b are complex
SparseCholeskySolver< double > chol_facto_mass_matrix
Cholesky factorisation of mass matrix if required.
computation of a few eigenvalues for sparse matrices
EigenProblem_Base()
default constructor
SparseDirectSolver< Complexe > mat_lu_cplx
factorisation of complex system
int eigenvalue_computation_mode
mode used to find eigenvalues (regular, shifted, Cayley, etc)
void ComputeAndFactorizeComplexMatrix(const complex< T0 > &a, const complex< T0 > &b, bool real_p=true)
intermediary function
void SetNbMaximumRestarts(int)
sets the restart parameter used in blocked solvers
MatrixFreeEigenProblem()
default constructor
void FactorizeCholeskyMass()
computes Cholesky factorisation of M from matrix M
double GetLowerBoundInterval() const
returns lower bound of the interval where eigenvalues are searched
int GetTypeSorting() const
returns how eigenvalues are sorted (real, imaginary part or modulus)
void ComputeSolution(const Vector< T0 > &X, Vector< T0 > &Y)
solution of (a M + b K) Y = X
void SetNbMaximumIterations(int n)
sets the maximal number of iterations allowed for the iterative algorithm
void SetPrintLevel(int lvl)
sets the level of verbosity
void ComputeAndFactorizeStiffnessMatrix(const T &a, const T &b)
computation of matrix a M + b K and factorisation of this matrix
void Clear()
clears memory used by the object
int GetComputationalMode() const
returns the spectral transformation used for evaluation of eigenvalues
void SortEigenvalues(Vector< T > &lambda_r, Vector< T > &lambda_i, Matrix< T, General, Storage1, Alloc1 > &eigen_old, Matrix< T, General, Storage2, Alloc2 > &eigen_new, int type_spectrum, int type_sort, const T &shift_r, const T &shift_i)
sorting eigenvalues
void SetNbArnoldiVectors(int n)
sets the number of Arnoldi vectors to use
void Clear()
clearing variables used for eigenvalue resolution
int nb_arnoldi_vectors
number of Arnoldi vectors
computation of a few eigenvalues with only matrix-vector product
void MltStiffness(const Vector< T > &X, Vector< T > &Y)
matrix vector product with stifness matrix Y = K X
void ComputeStiffnessMatrix()
computation of stiffness matrix K
int GetN() const
returns number of columns
void ComputeDiagonalMass()
computation of diagonal of mass matrix
MatMass::value_type MassValue
type for number stored in mass matrix
int nb_blocks
number of blocks for blocked solvers
void ComputeMassMatrix()
computation of mass matrix M
int ortho_manager
orthogonalization manager
bool diagonal_mass
if true, the generalized problem is reduced to a standard problem
SparseEigenProblem()
default constructor
void SetEigensolverType(int type)
sets the solver used in Anasazi
void MltCholeskyMass(const TransStatus &transA, Vector< T0 > &X)
computes L X or L^T x if M = L L^T
void SetNbAskedEigenvalues(int n)
sets the number of eigenvalues to compute
double stopping_criterion
threshold for Arpack's iterative process
Class grouping different direct solvers.
void ComputeSolution(const Vector< T0 > &X, Vector< T0 > &Y)
solves (a M + b K) Y = X with stored factorization
Matrix< T, Prop, Storage > mat_lu
LU factorisation of matrix.
int GetNbAskedEigenvalues() const
returns the number of eigenvalues asked by the user
void SetStoppingCriterion(double eps)
modifies the stopping critertion
bool automatic_selection_arnoldi_vectors
if true nb_arnoldi_vectors is automatically computed
static int GetDefaultSolver()
returns the default eigenvalue solver (linear eigenproblem)
Vector< Tmass > Xchol_real
temporary vectors for Cholesky
int nb_prod
number of matrix-vector products
void MltInvSqrtDiagonalMass(Vector< T0 > &X)
multiplication of X by D^-1/2
void ComputeSolution(const Vector< T0 > &X, Vector< T0 > &Y)
solving the linear system (a M + b K) Y = X
void IncrementProdMatVect()
increment of the number of matrix vector products
void SetNbAdditionalEigenvalues(int n)
sets the number of additional eigenvalues
int nb_eigenvalues_wanted
number of eigenvalues to be computed
void SolveCholeskyMass(const TransStatus &transA, Vector< T > &X)
computation of L^-1 X or L^-T x if M = L L^T
int restart_number
restart parameter for blocked solvers
void InitMatrix(MatStiff &)
initialization of a standard eigenvalue problem
void Clear()
memory release
bool use_cholesky
if true, the generalized problem is reduced to a standard problem
Vector< MassValue > sqrt_diagonal_mass
diagonal D^1/2 if the mass matrix is diagonal positive
void FactorizeDiagonalMass()
computation of D^1/2 from D
double GetStoppingCriterion() const
returns the stopping criterion
void ComputeAndFactorizeStiffnessMatrix(const T &a, const T &b)
computes and factorizes a M + b K where M is the mass matrix and K the stiffness matrix
int type_solver
which solver ?
void MltMass(const Vector< T > &X, Vector< T > &Y)
matrix vector product with mass matrix Y = M X
void SetCholeskyFactoForMass(bool chol=true)
indicates the use of Cholesky factorisation in order to solve a standard eigenvalue problem instead o...
bool DiagonalMass() const
returns true if the mass matrix is diagonal
double GetUpperBoundInterval() const
returns upper bound of the interval where eigenvalues are searched
int type_spectrum_wanted
which spectrum ? Near from Zero ? Near from Infinity ? or near from a value ?
double emin_interval
interval where eigenvalues are searched
void SetIntervalSpectrum(double, double)
sets the interval where eigenvalues are searched
int GetEigensolverType() const
returns the solver used in Anasazi
T GetImagShiftValue() const
returns the imaginary part of shift value used
DenseEigenProblem()
default constructor
Base class to solve an eigenvalue problem.
int nb_add_eigenvalues
additional number of eigenvalues
int GetM() const
returns number of rows
void FactorizeCholeskyMass()
Cholesky factorisation of mass matrix.
void SetNbBlocks(int)
returns the number of blocks used in blocked solvers
int type_sort_eigenvalues
large eigenvalues because of their real part, imaginary part or magnitude ?
int GetNbAdditionalEigenvalues() const
returns the additional number of eigenvalues
void SetTypeSpectrum(int type, const T &val, int type_sort=SORTED_MODULUS)
sets which eigenvalues are searched
bool UseCholeskyFactoForMass() const
returns true if Cholesky factorisation has to be used for mass matrix
Vector< int > pivot
pivot used by the LU factorisation
MatStiff * Kh
stiffness matrix
void SetDiagonalMass(bool diag=true)
indicates that the mass matrix is diagonal
bool imag_solution
if true, we take imaginary part of (K - sigma M)^-1
int GetPrintLevel() const
returns level of verbosity
friend void ApplyScalingEigenvec(EigenPb &var, Vector1 &eigen_values, Vector1 &lambda_imag, Matrix1 &eigen_vectors, const T0 &shiftr, const T0 &shifti)
modification of eigenvectors to take into account scaling by mass matrix
void SolveCholeskyMass(const TransStatus &transA, Vector< T0 > &X)
computes L^-1 X or L^-T x if M = L L^T
T GetShiftValue() const
returns the shift value used
Vector< double > Xchol_real
temporary vectors for Cholesky
void SolveCholeskyMass(const TransStatus &transA, Vector< T0 > &X)
computation of L^-1 X or L^-T X
void MltCholeskyMass(const TransStatus &transA, Vector< T > &X)
computation of L X or L^T x if M = L L^T
bool complex_system
if true consider Real( (a M + bK)^-1) or Imag( (a M + b K)^-1 ) or the whole system,...
int GetNbMatrixVectorProducts() const
returns the number of matrix-vector products performed since last call to Init
SparseDirectSolver< T > mat_lu
LU factorisation of sparse matrix.
int GetNbMaximumRestarts() const
returns the restart parameter used in blocked solvers
void ComputeMassForCholesky()
computation of mass matrix
void ComputeAndFactorizeStiffnessMatrix(const T &a, const T &b)
computation and factorisation of a M + b K
int GetNbBlocks() const
returns the number of blocks used in blocked solvers
int GetOrthoManager() const
returns orthogonalization manager set in Anasazi
int print_level
print level
void SetComputationalMode(int mode)
sets the spectral transformation used for evaluation of eigenvalues
void ComputeAndFactorizeComplexMatrix(const complex< T0 > &a, const complex< T0 > &b, bool real_p=true)
computation and factorisation of a M + b K
void SetShiftValue(const T &)
Sets the real part of shift value.
void SelectCholeskySolver(int type)
sets Cholesky solver to use
void SetImagShiftValue(const T &)
Sets the imaginary part of shift value.
int GetNbArnoldiVectors() const
returns the number of Arnoldi vectors to use
int GetNbMaximumIterations() const
returns the maximal number of iterations allowed for the iterative algorithm
void MltSqrtDiagonalMass(Vector< T0 > &X)
multiplication of X by D^1/2
void FactorizeCholeskyMass()
computation of Cholesky factorisation of M from matrix M