99 lines
4.0 KiB
Markdown
99 lines
4.0 KiB
Markdown
# EigenSolver
|
||
|
||
Compute eigenvalues and eigenvectors of a regular square matrix using the classical algorithm (LAPACK function [GEEV](https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2025-2/geev.html)).
|
||
|
||
Computing for type matrix<double>
|
||
|
||
```
|
||
bool matrix::EigenSolver(
|
||
ENUM_EIG_VECTORS jobv, // compute left and right eigenvectors
|
||
vectorc& eigen_values, // vector of computed eigenvalues
|
||
matrix& left_eigenvectors, // matrix of computed left vectors
|
||
matrix& right_eigenvectors // matrix of computed right vectors
|
||
);
|
||
|
||
```
|
||
|
||
Computing for type matrix<float>
|
||
|
||
```
|
||
bool matrixf::EigenSolver(
|
||
ENUM_EIG_VECTORS jobv, // compute left and right eigenvectors
|
||
vectorcf& eigen_values, // vector of computed eigenvalues
|
||
matrixf& left_eigenvectors, // matrix of computed left vectors
|
||
matrixf& right_eigenvectors // matrix of computed right vectors
|
||
);
|
||
|
||
```
|
||
|
||
Computing for type matrix<complex>
|
||
|
||
```
|
||
bool matrixc::EigenSolver(
|
||
ENUM_EIG_VECTORS jobv, // compute left and right vectors
|
||
vectorc& eigen_values, // vector of computed eigenvalues
|
||
matrixc& left_eigenvectors, // matrix of computed left vectors
|
||
matrixc& right_eigenvectors // matrix of computed right vectors
|
||
);
|
||
|
||
```
|
||
|
||
Computing for type matrix<complexf>
|
||
|
||
```
|
||
bool matrixcf::EigenSolver(
|
||
ENUM_EIG_VECTORS jobv, // compute left and right vectors
|
||
vectorcf& eigen_values, // vector of computed eigenvalues
|
||
matrixcf& left_eigenvectors, // matrix of computed left vectors
|
||
matrixcf& right_eigenvectors // matrix of computed right vectors
|
||
);
|
||
|
||
```
|
||
|
||
Parameters
|
||
|
||
jobv
|
||
|
||
[in] [ENUM_EIG_VECTORS](/en/docs/matrix/openblas/eigen_values/general_matrices/eigensolver#enum_eig_vectors) enumeration value which determines the method for computing left and right eigenvectors.
|
||
|
||
EV
|
||
|
||
[out] Vector of eigenvalues.
|
||
|
||
left_eigenvectors
|
||
|
||
[out] Matrix of left eigenvectors.
|
||
|
||
right_eigenvectors
|
||
|
||
[out] Matrix of right eigenvectors.
|
||
|
||
Return Value
|
||
|
||
Return true if successful, otherwise false in case of an [error](/en/docs/constants/errorswarnings/errorcodes).
|
||
|
||
Note
|
||
|
||
Computation depends on the value of the jobv parameter.
|
||
|
||
If EIGVECTORS_N is set, the left and right vectors are not computed. Only eigenvalues are computed.
|
||
|
||
With EIGVECTORS_L, only left eigenvectors are computed, right eigenvectors are not computed.
|
||
|
||
When EIGVECTORS_R is set, only the right eigenvectors are computed, the left vectors are not computed.
|
||
|
||
With EIGVECTORS_LR, the left and right eigenvectors are computed, Eigenvalues are always computed.
|
||
|
||
Real (non-complex) matrices can have a complex solution. Therefore, the vector of eigenvalues must be complex. In case of a complex solution, the error code is set to 4019 (ERR_MATH_OVERFLOW). Otherwise, only the real parts of the complex values of the eigenvalue vector should be used.
|
||
|
||
ENUM_EIG_VECTORS
|
||
|
||
An enumeration that specifies whether to calculate eigenvectors.
|
||
|
||
| ID | Description |
|
||
| --- | --- |
|
||
| EIGVECTORS_N | Only eigenvalues are calculated, without vectors. |
|
||
| EIGVECTORS_L | Only left eigenvectors are computed. |
|
||
| EIGVECTORS_R | Only right eigenvectors are computed. |
|
||
| EIGVECTORS_LR | Left and right eigenvectors are computed, eigenvalues are always computed. |
|