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 (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 matrix that compute the eigenvalues. More... | |
EigenProblemSolver (Equa< real_t > &eq, bool lumped=true) | |
Consrtuctor using partial differential equation. More... | |
~EigenProblemSolver () | |
Destructor. | |
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 | setPDE (Equa< real_t > &eq, bool lumped=true) |
Define partial differential equation to solve. More... | |
int | run (int nb=0) |
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) const |
Return the n-th eigenvalue. | |
void | getEigenVector (int n, Vect< real_t > &v) const |
Return the n-th eigenvector. More... | |
Detailed Description
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.
- Author
- Rachid Touzani
- Copyright
- GNU Lesser Public License
Constructor & Destructor Documentation
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 (No need to use the function runSubSpace). The eigenvectors can be obtained by calling the member function getEigenVector.
- Parameters
-
[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.
- Parameters
-
[in] K "Stiffness" matrix [in] M "Mass" matrix [in] n Number of eigenvalues to extract. By default all eigenvalues are computed.
- Note
- The generalized eigenvalue problem is defined by
Kx = aMx
, whereK
andM
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.
- Parameters
-
[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.
- Note
- The generalized eigenvalue problem is defined by
Kx = aMx
, whereK
andM
are referred to as stiffness and mass matrix.
EigenProblemSolver | ( | DSMatrix< real_t > & | A, |
Vect< real_t > & | ev, | ||
int | n = 0 |
||
) |
Constructor for a dense matrix that compute the eigenvalues.
This constructor solves in place the eigenvalues problem and stores them in a vector (No need to use the function runSubSpace). The eigenvectors can be obtained by calling the member function getEigenVector.
- Parameters
-
[in] A Matrix for which eigenmodes are sought. [in] ev Vector containing all computed eigenvalues sorted increasingly. [in] n Number of eigenvalues to extract. By default all eigenvalues are computed.
- Remarks
- The vector ev does not need to be sized before.
EigenProblemSolver | ( | Equa< real_t > & | eq, |
bool | lumped = true |
||
) |
Consrtuctor using partial differential equation.
The used equation class must have been constructed using the Mesh instance
- Parameters
-
[in] eq Reference to equation instance [in] lumped Mass matrix is lumped (true) or not (false) [Default: true
]
Member Function Documentation
Set matrix instances (Symmetric matrices).
This function is to be used when the default constructor is applied. Case where the mass matrix is consistent.
- Parameters
-
[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.
- Parameters
-
[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
- Parameters
-
[in] K Stiffness matrix instance
Define partial differential equation to solve.
The used equation class must have been constructed using the Mesh instance
- Parameters
-
[in] eq Reference to equation instance [in] lumped Mass matrix is lumped (true) or not (false) [Default: true
]
int run | ( | int | nb = 0 | ) |
Run the eigenproblem solver.
- Parameters
-
[in] nb Number of eigenvalues to be computed. By default, all eigenvalues are computed.
Assemble element arrays into global matrices.
This member function is to be called from finite element equation classes
- Parameters
-
[in] el Reference to Element class [in] eK Pointer to element stiffness (or assimilated) matrix [in] eM Pointer to element mass (or assimilated) matrix
Assemble side arrays into global matrix and right-hand side.
This member function is to be called from finite element equation classes
- Parameters
-
[in] sd Reference to Side class [in] sK Pointer to side stiffness
int runSubSpace | ( | size_t | nb_eigv, |
size_t | ss_dim = 0 |
||
) |
Run the subspace iteration solver.
This function rune the Bathe subspace iteration method.
- Parameters
-
[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
]
- Returns
- 1: Normal execution. Convergence has been achieved. 2: Convergence for eigenvalues has not been attained.
void setSubspaceDimension | ( | int | dim | ) |
Define the subspace dimension.
- Parameters
-
[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
- Parameters
-
[in] eps Convergence tolerance for eigenvalues [Default: 1.e-8]
int checkSturm | ( | int & | nb_found, |
int & | nb_lost | ||
) |
Check how many eigenvalues have been found using Sturm sequence method.
- Parameters
-
[out] nb_found number of eigenvalues actually found [out] nb_lost number of eigenvalues missing
- Returns
- - 0, Successful completion of subroutine.
- 1, No convergent eigenvalues found.