Class to find eigenvalues and corresponding eigenvectors of a given matrix in a generalized eigenproblem, i.e. Find scalars l and non-null vectors v such that [K]{v} = l[M]{v} where [K] and [M] are symmetric matrices. The eigenproblem can be originated from a PDE. For this, we will refer to the matrices K and M as Stiffness and Mass matrices respectively. More...
Public Member Functions | |
EigenProblemSolver () | |
Default constructor. | |
EigenProblemSolver (DMatrix< real_t > &A, bool eigv=false) | |
Constructor for a dense unsymmetric matrix that computes the eigenvalues. More... | |
EigenProblemSolver (DSMatrix< real_t > &K, int n=0) | |
Constructor for a dense symmetric matrix that computes the eigenvalues. More... | |
EigenProblemSolver (SkSMatrix< real_t > &K, SkSMatrix< real_t > &M, int n=0) | |
Constructor for Symmetric Skyline Matrices. More... | |
EigenProblemSolver (SkSMatrix< real_t > &K, Vect< real_t > &M, int n=0) | |
Constructor for Symmetric Skyline Matrices. More... | |
EigenProblemSolver (DSMatrix< real_t > &A, Vect< real_t > &ev, int n=0) | |
Constructor for a dense symmetric matrix that compute the eigenvalues. More... | |
EigenProblemSolver (DMatrix< real_t > &A, Vect< real_t > &evr, Vect< real_t > &evi, bool eigv=false) | |
Constructor for a dense matrix that compute the eigenvalues. More... | |
EigenProblemSolver (Equa &eq, bool lumped=true) | |
Consrtuctor using partial differential equation. More... | |
~EigenProblemSolver () | |
Destructor. | |
void | set (EigenMethod m, bool sym) |
Set numerical method for eigenvalue computation. More... | |
void | setMatrix (Matrix< real_t > *K) |
Set pointer to matrix instance. More... | |
void | setMatrix (Matrix< real_t > *K, Matrix< real_t > *M) |
Set pointers to matrix instances. More... | |
void | setMatrix (SkSMatrix< real_t > &K, SkSMatrix< real_t > &M) |
Set matrix instances (Symmetric matrices). More... | |
void | setMatrix (SkSMatrix< real_t > &K, Vect< real_t > &M) |
Set matrix instances (Symmetric matrices). More... | |
void | setMatrix (DSMatrix< real_t > &K) |
Set matrix instance (Symmetric matrix). More... | |
void | setMatrix (DMatrix< real_t > &K) |
Set matrix instance. More... | |
void | setNbEigv (int n) |
Set number of extracted eigenvalues. More... | |
void | setEigenVectors () |
Switch to compute (or not) eigenvectors as well. More... | |
void | setPDE (Equa &eq, bool lumped=true) |
Define partial differential equation to solve. More... | |
int | run (int nb=0, bool opt=false) |
Run the eigenproblem solver. More... | |
void | Assembly (const Element &el, real_t *eK, real_t *eM) |
Assemble element arrays into global matrices. More... | |
void | SAssembly (const Side &sd, real_t *sK) |
Assemble side arrays into global matrix and right-hand side. More... | |
int | runSubSpace (size_t nb_eigv, size_t ss_dim=0) |
Run the subspace iteration solver. More... | |
void | setSubspaceDimension (int dim) |
Define the subspace dimension. More... | |
void | setMaxIter (int max_it) |
set maximal number of iterations. | |
void | setTolerance (real_t eps) |
set tolerance value More... | |
int | checkSturm (int &nb_found, int &nb_lost) |
Check how many eigenvalues have been found using Sturm sequence method. More... | |
int | getNbIter () const |
Return actual number of performed iterations. | |
real_t | getEigenValue (int n, int i=1) const |
Return the n-th eigenvalue. More... | |
void | getEigenVector (int n, Vect< real_t > &v) const |
Return the n-th eigenvector. More... | |
void | getEigenVector (int n, Vect< real_t > &vr, Vect< real_t > &vi) const |
Return the n-th eigenvector in the case of complex eigenvectors. More... | |
Class to find eigenvalues and corresponding eigenvectors of a given matrix in a generalized eigenproblem, i.e. Find scalars l and non-null vectors v such that [K]{v} = l[M]{v} where [K] and [M] are symmetric matrices. The eigenproblem can be originated from a PDE. For this, we will refer to the matrices K and M as Stiffness and Mass matrices respectively.
EigenProblemSolver | ( | DMatrix< real_t > & | A, |
bool | eigv = false |
||
) |
Constructor for a dense unsymmetric matrix that computes the eigenvalues.
This constructor solves in place the eigenvalues problem and stores them in a vector. The eigenvectors can be obtained by calling the member function getEigenVector. Eigenvalue extraction uses the reduction to Hessenberg form of the matrix.
[in] | A | Matrix for which eigenmodes are sought. |
[in] | eigv | Switch to compute or not eigenvectors [Default: false ] |
EigenProblemSolver | ( | DSMatrix< real_t > & | K, |
int | n = 0 |
||
) |
Constructor for a dense symmetric matrix that computes the eigenvalues.
This constructor solves in place the eigenvalues problem and stores them in a vector. The eigenvectors can be obtained by calling the member function getEigenVector.
[in] | K | Matrix for which eigenmodes are sought. |
[in] | n | Number of eigenvalues to extract. By default all eigenvalues are computed. |
EigenProblemSolver | ( | SkSMatrix< real_t > & | K, |
SkSMatrix< real_t > & | M, | ||
int | n = 0 |
||
) |
Constructor for Symmetric Skyline Matrices.
[in] | K | "Stiffness" matrix |
[in] | M | "Mass" matrix |
[in] | n | Number of eigenvalues to extract. By default all eigenvalues are computed. |
Kx = aMx
, where K
and M
are referred to as stiffness and mass matrix. EigenProblemSolver | ( | SkSMatrix< real_t > & | K, |
Vect< real_t > & | M, | ||
int | n = 0 |
||
) |
Constructor for Symmetric Skyline Matrices.
[in] | K | "Stiffness" matrix |
[in] | M | Diagonal "Mass" matrix stored as a Vect instance |
[in] | n | Number of eigenvalues to extract. By default all eigenvalues are computed. |
Kx = aMx
, where K
and M
are referred to as stiffness and mass matrix. EigenProblemSolver | ( | DSMatrix< real_t > & | A, |
Vect< real_t > & | ev, | ||
int | n = 0 |
||
) |
Constructor for a dense symmetric matrix that compute the eigenvalues.
This constructor solves in place the eigenvalues problem and stores them in a vector. Extraction of eigenvalues and eigenvectors uses the subspace iteration method. The eigenvectors can be obtained by calling the member function getEigenVector.
[in] | A | Matrix for which eigenmodes are sought. |
[in] | ev | Vector containing all computed (real) eigenvalues. |
[in] | n | Number of eigenvalues to extract. By default all eigenvalues are computed. |
EigenProblemSolver | ( | DMatrix< real_t > & | A, |
Vect< real_t > & | evr, | ||
Vect< real_t > & | evi, | ||
bool | eigv = false |
||
) |
Constructor for a dense matrix that compute the eigenvalues.
This constructor solves in place the eigenvalues problem and stores them separately in real and imaginary part vectors. Extraction of eigenvalues and eigenvectors uses the QR method after transforming the matrix in Hessenberg form. The eigenvectors can be obtained by calling the member function getEigenVector.
[in] | A | Matrix for which eigenmodes are sought. |
[in] | evr | Vector containing real parts of eigenvalues. |
[in] | evi | Vector containing imaginary parts of eigenvalues. |
[in] | eigv | Switch to say if eigenvectors are to be computed [Default: false ]. |
evr
and evi
do not need to be sized before. EigenProblemSolver | ( | Equa & | eq, |
bool | lumped = true |
||
) |
Consrtuctor using partial differential equation.
The used equation class must have been constructed using the Mesh instance
[in] | eq | Reference to equation instance |
[in] | lumped | Mass matrix is lumped (true) or not (false) [Default: true ] |
Assemble element arrays into global matrices.
This member function is to be called from finite element equation classes
[in] | el | Reference to Element class |
[in] | eK | Pointer to element stiffness (or assimilated) matrix |
[in] | eM | Pointer to element mass (or assimilated) matrix |
int checkSturm | ( | int & | nb_found, |
int & | nb_lost | ||
) |
Check how many eigenvalues have been found using Sturm sequence method.
[out] | nb_found | number of eigenvalues actually found |
[out] | nb_lost | number of eigenvalues missing |
real_t getEigenValue | ( | int | n, |
int | i = 1 |
||
) | const |
Return the n-th eigenvalue.
[in] | n | Index of eigenvalue (must be > 0) |
[in] | i | i=1: Real part, i=2: Imaginary part. [Default: 1] |
Return the n-th eigenvector.
[in] | n | Label of eigenvector (They are stored in ascending order of eigenvalues) |
[out] | v | Vect instance where the eigenvector is stored. |
int run | ( | int | nb = 0 , |
bool | opt = false |
||
) |
Run the eigenproblem solver.
[in] | nb | Number of eigenvalues to be computed. By default, all eigenvalues are computed. |
[in] | opt | Toggle to compute or not corresponding eigenvectors. By default, no eigenvectors extracted. |
int runSubSpace | ( | size_t | nb_eigv, |
size_t | ss_dim = 0 |
||
) |
Run the subspace iteration solver.
This function rune the Bathe subspace iteration method.
[in] | nb_eigv | Number of eigenvalues to be extracted |
[in] | ss_dim | Subspace dimension. Must be at least equal to the number eigenvalues to seek. [Default: nb_eigv ] |
Assemble side arrays into global matrix and right-hand side.
This member function is to be called from finite element equation classes
[in] | sd | Reference to Side class |
[in] | sK | Pointer to side stiffness |
void set | ( | EigenMethod | m, |
bool | sym | ||
) |
Set numerical method for eigenvalue computation.
[in] | m | Numerical method to compute eigenvalues:
|
[in] | sym | Boolean variable to say if matrix is symmetric or not |
void setEigenVectors | ( | ) |
Switch to compute (or not) eigenvectors as well.
This function is useful for the QR method. BY default eigenvectors are not extracted.
Set pointer to matrix instance.
This function is to be used when the default constructor is applied. Case where the mass matrix is consistent.
[in] | K | Stiffness matrix pointer |
Set pointers to matrix instances.
This function is to be used when the default constructor is applied. Case where the mass matrix is consistent.
[in] | K | Stiffness matrix instance pointer |
[in] | M | Mass matrix instance pointer |
Set matrix instances (Symmetric matrices).
This function is to be used when the default constructor is applied. Case where the mass matrix is consistent.
[in] | K | Stiffness matrix instance |
[in] | M | Mass matrix instance |
Set matrix instances (Symmetric matrices).
This function is to be used when the default constructor is applied. Case where the mass matrix is (lumped) diagonal and stored in a vector.
[in] | K | Stiffness matrix instance |
[in] | M | Mass matrix instance where diagonal terms are stored as a vector. |
Set matrix instance (Symmetric matrix).
This function is to be used when the default constructor is applied. Case of a standard (not generalized) eigen problem is to be solved
[in] | K | Matrix instance |
Set matrix instance.
This function is to be used when the default constructor is applied. Case of a standard (not generalized) eigen problem is to be solved
[in] | K | Matrix instance |
void setNbEigv | ( | int | n | ) |
Set number of extracted eigenvalues.
This function is useful for the subspace method only.
[in] | n | Number of eigenvalues to compute. Must be at most equal to the matrix size |
void setPDE | ( | Equa & | eq, |
bool | lumped = true |
||
) |
Define partial differential equation to solve.
The used equation class must have been constructed using the Mesh instance
[in] | eq | Reference to equation instance |
[in] | lumped | Mass matrix is lumped (true) or not (false) [Default: true ] |
void setSubspaceDimension | ( | int | dim | ) |
Define the subspace dimension.
[in] | dim | Subspace dimension. Must be larger or equal to the number of wanted eigenvalues. By default this value will be set to the number of wanted eigenvalues |
void setTolerance | ( | real_t | eps | ) |
set tolerance value
[in] | eps | Convergence tolerance for eigenvalues [Default: 1.e-8] |