PolynomialEigenvalueSolver.hxx
1 #ifndef SELDON_FILE_POLYNOMIAL_EIGENVALUE_SOLVER_HXX
2 
3 namespace Seldon
4 {
7  {
8  protected:
11 
12  public :
13  enum {TOAR, STOAR, QARNOLDI, LINEAR, JD};
14 
15  SlepcParamPep();
16 
17  int GetEigensolverType() const;
18  void SetEigensolverType(int type);
19 
20  };
21 
22 
24  template<class T>
26  {
27  public:
28  typedef typename ClassComplexType<T>::Tcplx Tcplx;
29  typedef typename ClassComplexType<T>::Treal Treal;
30 
31  protected:
34 
37 
40  FeastParam feast_param;
41 
44  Vector<T> invDiag;
45 
46  public:
48 
49  bool UseSpectralTransformation() const;
50  void SetSpectralTransformation(bool t = true);
51 
54 
55  int GetPolynomialDegree() const;
56 
57  void SetDiagonalMass(bool diag = true);
58  bool DiagonalMass();
59 
60  // virtual methods overloaded in leaf classes
61  virtual void ComputeOperator(int num, const Vector<T>& coef);
62  virtual void MltOperator(int num, const SeldonTranspose&, const Vector<T>& X, Vector<T>& Y);
63 
64  virtual void FactorizeMass();
65  virtual void SolveMass(const SeldonTranspose&, const Vector<T>& x, Vector<T>& y);
66 
67  virtual void FactorizeOperator(const Vector<T>& coef);
68  virtual void SolveOperator(const SeldonTranspose&, const Vector<T>& X, Vector<T>& Y);
69 
70  };
71 
73  template<class T>
75  {
76  protected:
77  Vector<VirtualMatrix<T>* > list_op;
78  Vector<Vector<T> > list_coef;
79 
80  public:
81  void InitMatrix(const Vector<VirtualMatrix<T>* >& op, int n = -1);
82 
83  void ComputeOperator(int num, const Vector<T>& coef);
84  void MltOperator(int num, const SeldonTranspose&, const Vector<T>& X, Vector<T>& Y);
85 
86  bool IsSymmetricProblem() const;
87  bool IsHermitianProblem() const;
88 
89  };
90 
92  template<class T, class Prop, class Storage>
94  {
95  protected:
98  Vector<int> pivot;
99 
100  public:
101  void InitMatrix(const Vector<Matrix<T, Prop, Storage>* >& op);
102 
103  void FactorizeMass();
104  void SolveMass(const SeldonTranspose&, const Vector<T>& x, Vector<T>& y);
105 
106  void FactorizeOperator(const Vector<T>& coef);
107  void SolveOperator(const SeldonTranspose&, const Vector<T>& X, Vector<T>& Y);
108 
109  };
110 
112 #ifdef SELDON_WITH_MPI
113  template<class T, class MatStiff,
115 #else
116  template<class T, class MatStiff,
118 #endif
120  {
121  protected:
122 
123 #ifdef SELDON_WITH_MPI
126 #else
129 #endif
130 
131  // stiffness matrices and mass matrix
133  MatMass* Mh;
134 
135  // parallel stuff
136  bool distributed; int nloc;
137  Vector<int> local_col_numbers;
138  Vector<int>* ProcSharingRows;
139  Vector<Vector<int> >* SharingRowNumbers;
140  int nodl_scalar_, nb_unknowns_scal_;
141 
142  int RetrieveLocalNumbers(MatStiff& K);
143 
144  public:
146 
147  void InitMatrix(Vector<MatStiff*>&, MatMass&);
148 
149  void FactorizeMass();
150  void SolveMass(const SeldonTranspose&, const Vector<T>& x, Vector<T>& y);
151 
152  void FactorizeOperator(const Vector<T>& coef);
153  void SolveOperator(const SeldonTranspose&, const Vector<T>& X, Vector<T>& Y);
154 
155  void MltOperator(int num, const SeldonTranspose&, const Vector<T>& X, Vector<T>& Y);
156 
158 
159  };
160 
161  template<class T, class Prop, class Storage>
162  void GetEigenvaluesEigenvectors(PolynomialEigenProblem_Base<T>& var_eig,
163  Vector<T>& lambda, Vector<T>& lambda_imag,
164  Matrix<T, Prop, Storage>& eigen_vec,
165  int type_solver = TypeEigenvalueSolver::DEFAULT);
166 }
167 
168 #define SELDON_FILE_POLYNOMIAL_EIGENVALUE_SOLVER_HXX
169 #endif
Seldon::SeldonTranspose
Definition: MatrixFlag.hxx:32
Seldon::PolynomialDenseEigenProblem::FactorizeMass
void FactorizeMass()
to overload
Definition: PolynomialEigenvalueSolver.cxx:250
Seldon::PolynomialSparseEigenProblem
implementation of sparse polynomial eigenvalue solver
Definition: PolynomialEigenvalueSolver.hxx:119
Seldon::PolynomialEigenProblem::MltOperator
void MltOperator(int num, const SeldonTranspose &, const Vector< T > &X, Vector< T > &Y)
Computes Y = A X where A is the operator num.
Definition: PolynomialEigenvalueSolver.cxx:184
Seldon::PolynomialSparseEigenProblem::SolveMass
void SolveMass(const SeldonTranspose &, const Vector< T > &x, Vector< T > &y)
to overload for non-diagonal mass
Definition: PolynomialEigenvalueSolver.cxx:449
Seldon::PolynomialEigenProblem_Base::GetSlepcParameters
SlepcParamPep & GetSlepcParameters()
returns object storing slepc parameters
Definition: PolynomialEigenvalueSolver.cxx:55
Seldon::PolynomialEigenProblem_Base::SolveMass
virtual void SolveMass(const SeldonTranspose &, const Vector< T > &x, Vector< T > &y)
to overload for non-diagonal mass
Definition: PolynomialEigenvalueSolver.cxx:123
Seldon::Vector< T >
Seldon::SparseDistributedSolver
general class for direct solver
Definition: DistributedSolver.hxx:15
Seldon::PolynomialSparseEigenProblem::mat_lu
SparseDirectSolver< T > mat_lu
LU factorization of sparse matrix.
Definition: PolynomialEigenvalueSolver.hxx:128
Seldon::PolynomialEigenProblem_Base::FactorizeMass
virtual void FactorizeMass()
to overload
Definition: PolynomialEigenvalueSolver.cxx:113
Seldon::PolynomialEigenProblem
matrix-free implementation of polynomial eigenvalue solver
Definition: PolynomialEigenvalueSolver.hxx:74
Seldon::PolynomialEigenProblem::IsHermitianProblem
bool IsHermitianProblem() const
returns true if the problem is hermitian
Definition: PolynomialEigenvalueSolver.cxx:227
Seldon::Matrix< T, Prop, Storage >
Seldon::PolynomialSparseEigenProblem::MltOperator
void MltOperator(int num, const SeldonTranspose &, const Vector< T > &X, Vector< T > &Y)
Computes Y = A X where A is the operator num.
Definition: PolynomialEigenvalueSolver.cxx:501
Seldon::PolynomialEigenProblem_Base::GetFeastParameters
FeastParam & GetFeastParameters()
returns object storing Feast parameters
Definition: PolynomialEigenvalueSolver.cxx:63
Seldon::SparseDirectSolver
Class grouping different direct solvers.
Definition: SparseDirectSolver.hxx:26
Seldon::PolynomialEigenProblem_Base::pol_degree
int pol_degree
polynomial degree
Definition: PolynomialEigenvalueSolver.hxx:36
Seldon::PolynomialEigenProblem_Base::slepc_param
SlepcParamPep slepc_param
Slepc parameters.
Definition: PolynomialEigenvalueSolver.hxx:39
Seldon::PolynomialEigenProblem_Base::diagonal_mass
bool diagonal_mass
mass diagonal ?
Definition: PolynomialEigenvalueSolver.hxx:43
Seldon::PolynomialEigenProblem_Base::DiagonalMass
bool DiagonalMass()
returns true if the mass is diagonal
Definition: PolynomialEigenvalueSolver.cxx:87
Seldon::PolynomialEigenProblem::InitMatrix
void InitMatrix(const Vector< VirtualMatrix< T > * > &op, int n=-1)
inits the operators of the polynomial
Definition: PolynomialEigenvalueSolver.cxx:160
Seldon::PolynomialEigenProblem::ComputeOperator
void ComputeOperator(int num, const Vector< T > &coef)
computes the operator with coefficients stored in coef
Definition: PolynomialEigenvalueSolver.cxx:173
Seldon::PolynomialEigenProblem::IsSymmetricProblem
bool IsSymmetricProblem() const
returns true if the problem is symmetric
Definition: PolynomialEigenvalueSolver.cxx:215
Seldon::SlepcParamPep::type_solver
int type_solver
which solver ?
Definition: PolynomialEigenvalueSolver.hxx:10
Seldon::PolynomialSparseEigenProblem::DistributeEigenvectors
void DistributeEigenvectors(Matrix< T, General, ColMajor > &eigen_vec)
changes final eigenvectors if needed
Definition: PolynomialEigenvalueSolver.cxx:549
Seldon::PolynomialEigenProblem_Base::use_spectral_transfo
bool use_spectral_transfo
if true teta is searched (lambda = shift + 1/teta)
Definition: PolynomialEigenvalueSolver.hxx:33
Seldon::PolynomialDenseEigenProblem::SolveMass
void SolveMass(const SeldonTranspose &, const Vector< T > &x, Vector< T > &y)
to overload for non-diagonal mass
Definition: PolynomialEigenvalueSolver.cxx:269
Seldon::PolynomialDenseEigenProblem
implementation of polynomial eigenvalue solver for dense problem
Definition: PolynomialEigenvalueSolver.hxx:93
Seldon::PolynomialSparseEigenProblem::FactorizeMass
void FactorizeMass()
to overload
Definition: PolynomialEigenvalueSolver.cxx:415
Seldon::PolynomialEigenProblem_Base
Base class for polynomial eigenvalue solver.
Definition: PolynomialEigenvalueSolver.hxx:25
Seldon::DistributedMatrix
matrix distributed over all the processors
Definition: DistributedMatrix.hxx:506
Seldon::PolynomialEigenProblem_Base::ComputeOperator
virtual void ComputeOperator(int num, const Vector< T > &coef)
to overload
Definition: PolynomialEigenvalueSolver.cxx:95
Seldon::PolynomialEigenProblem_Base::SetDiagonalMass
void SetDiagonalMass(bool diag=true)
sets a diagonal mass
Definition: PolynomialEigenvalueSolver.cxx:79
Seldon::PolynomialEigenProblem_Base::SetSpectralTransformation
void SetSpectralTransformation(bool t=true)
enables a spectral transformation
Definition: PolynomialEigenvalueSolver.cxx:47
Seldon::PolynomialEigenProblem_Base::GetPolynomialDegree
int GetPolynomialDegree() const
returns the polynomial degree
Definition: PolynomialEigenvalueSolver.cxx:71
Seldon
Seldon namespace.
Definition: Array.cxx:24
Seldon::GeneralEigenProblem
class for solving a general eigenproblem with parameter T (double or complex)
Definition: VirtualEigenvalueSolver.hxx:349
Seldon::PolynomialEigenProblem_Base::UseSpectralTransformation
bool UseSpectralTransformation() const
returns true if a spectral transformation has to be used
Definition: PolynomialEigenvalueSolver.cxx:39
Seldon::FeastParam
parameters for Feast package
Definition: VirtualEigenvalueSolver.hxx:165
Seldon::VirtualMatrix
Abstract base class for all matrices.
Definition: Matrix_Base.hxx:42
Seldon::PolynomialEigenProblem_Base::MltOperator
virtual void MltOperator(int num, const SeldonTranspose &, const Vector< T > &X, Vector< T > &Y)
to overload
Definition: PolynomialEigenvalueSolver.cxx:104
Seldon::PolynomialEigenProblem_Base::PolynomialEigenProblem_Base
PolynomialEigenProblem_Base()
default constructor
Definition: PolynomialEigenvalueSolver.cxx:29
Seldon::SlepcParamPep
Parameters for Slepc package.
Definition: PolynomialEigenvalueSolver.hxx:6