![]() |
CLA3P v0.3.1
Compact Linear Algebra Parallel Portable Package
|
Eigenvalue decomposition solver using LAPACK SYEV/HEEV routines. More...
Public Member Functions | |
| LapackSyev () | |
| Default constructor. | |
| LapackSyev (bool calcEigenvectors) | |
| Constructor with explicit eigenvector option. | |
| ~LapackSyev () | |
| Destructor. | |
| void | clear () |
| Clears all internal data and releases allocated memory. | |
| void | reserve (int_t n) |
Pre-allocates internal buffers for a matrix of dimension n. | |
| void | decompose (const T_Matrix &mat) |
Performs the eigenvalue decomposition of mat. | |
| void | setCalcEigenvectors (bool calcEigenvectors) |
| Sets whether to compute eigenvectors. | |
| bool | getCalcEigenvectors () const |
| Checks if eigenvectors will be computed. | |
| const T_RVector & | eigenvalues () const |
| Returns the computed eigenvalues. | |
| const T_Matrix & | eigenvectors () const |
| Returns the computed eigenvectors. | |
Eigenvalue decomposition solver using LAPACK SYEV/HEEV routines.
This class provides a high-level interface for computing eigenvalues and eigenvectors of symmetric (real) or Hermitian (complex) square matrices using the LAPACK HEEV implementation (real: dsyev/ssyev, complex: zheev/cheev).
The HEEV routine computes the eigenvalue decomposition of a symmetric/Hermitian matrix \( A \):
\[ A \, v_i = \lambda_i \, v_i, \qquad \lambda_i \in \mathbb{R} \]
where all eigenvalues \( \lambda_i \) are guaranteed to be real. The eigenvectors form an orthonormal basis satisfying \( V^H V = I \).
Unlike LapackGeev, eigenvalues are returned as real-valued quantities. Eigenvectors share the scalar type of the input matrix (real for real input, complex for complex input). Internal buffers are managed automatically and can be pre-allocated via reserve() to avoid repeated heap allocations when the solver is reused for multiple decompositions.
| T_Matrix | The dense symmetric/Hermitian matrix type to decompose. |
| cla3p::LapackSyev< T_Matrix >::LapackSyev | ( | ) |
Default constructor.
Initializes the eigenvalue solver with default settings. calcEigenvectors is set to true, so eigenvectors are computed by default.
| cla3p::LapackSyev< T_Matrix >::LapackSyev | ( | bool | calcEigenvectors | ) |
Constructor with explicit eigenvector option.
Initializes the eigenvalue solver with the specified eigenvector computation option. Use this form when only eigenvalues are needed, which avoids the additional cost of computing the eigenvector matrix.
| [in] | calcEigenvectors | If true, eigenvectors will be computed in decompose(). |
| cla3p::LapackSyev< T_Matrix >::~LapackSyev | ( | ) |
Destructor.
Releases all allocated resources and clears internal state.
| void cla3p::LapackSyev< T_Matrix >::clear | ( | ) |
Clears all internal data and releases allocated memory.
Resets the solver to its initial state, releasing all computed results, internal workspace buffers, and resetting options to their defaults (calcEigenvectors = true).
| void cla3p::LapackSyev< T_Matrix >::reserve | ( | int_t | n | ) |
Pre-allocates internal buffers for a matrix of dimension n.
Allocates all real and scalar workspace buffers required for eigenvalue decomposition of an n x n matrix. Calling this before decompose() avoids repeated heap allocations when the same solver instance is reused across multiple decompositions of equal or smaller size.
| [in] | n | Matrix dimension. |
| void cla3p::LapackSyev< T_Matrix >::decompose | ( | const T_Matrix & | mat | ) |
Performs the eigenvalue decomposition of mat.
Computes the eigenvalues and, depending on the current setting, the eigenvectors of mat using the LAPACK HEEV routine. The input matrix is copied internally before factorization; the original is left unmodified.
Results are accessible via eigenvalues() and eigenvectors() after this call returns.
| [in] | mat | Square symmetric/Hermitian dense matrix to decompose. |
| void cla3p::LapackSyev< T_Matrix >::setCalcEigenvectors | ( | bool | calcEigenvectors | ) |
Sets whether to compute eigenvectors.
Takes effect on the next call to decompose(). Changing this setting after reserve() has been called will require new buffer allocations on the next decompose().
| [in] | calcEigenvectors | If true, eigenvectors will be computed. |
| bool cla3p::LapackSyev< T_Matrix >::getCalcEigenvectors | ( | ) | const |
Checks if eigenvectors will be computed.
true if eigenvectors will be computed, false otherwise. | const T_RVector & cla3p::LapackSyev< T_Matrix >::eigenvalues | ( | ) | const |
Returns the computed eigenvalues.
Each element i of the returned vector is the i-th eigenvalue \( \lambda_i \), sorted in ascending order, matching the column ordering of eigenvectors().
n containing the eigenvalues. | const T_Matrix & cla3p::LapackSyev< T_Matrix >::eigenvectors | ( | ) | const |
Returns the computed eigenvectors.
Column i of the returned matrix contains the orthonormal eigenvector \( v_i \) satisfying \( A v_i = \lambda_i v_i \), where \( \lambda_i \) is eigenvalues() [i]. The columns form an orthonormal basis: \( V^H V = I \).
n x n matrix of eigenvectors, with the same scalar type as the input matrix. true.