|
NumericAL
A header-only C++20 lexer built on REAL
|
The eigenvalues and eigenvectors of a real symmetric matrix. More...
#include <decomposition.hpp>
Public Member Functions | |
| symmetric_eigen (const matrix< double > &input, eigen_method method=eigen_method::divide_and_conquer) | |
Diagonalises input. | |
| const vector< double > & | values () const noexcept |
| The eigenvalues, ascending. | |
| const matrix< double > & | vectors () const &noexcept |
| The eigenvectors as columns, ordered to match values. | |
| matrix< double > | vectors () && |
| The eigenvectors, moved out of an expiring decomposition. | |
Private Member Functions | |
| void | extract_sorted (const buffer< double > &diagonal, const buffer< double > &v) |
Sorts the eigenvalues diagonal ascending and reorders v's columns to match. | |
Private Attributes | |
| std::size_t | n_ |
| The matrix order. | |
| vector< double > | values_ |
| Eigenvalues, ascending. | |
| matrix< double > | vectors_ |
| Eigenvectors as columns. | |
The eigenvalues and eigenvectors of a real symmetric matrix.
By default the matrix is reduced to tridiagonal form by Householder reflections and the tridiagonal is diagonalised by divide and conquer (eigen_method::divide_and_conquer), the method of LAPACK's dsyevd, most of its work in matrix products; implicit QL (eigen_method::tridiagonal_ql, dsyev's) and cyclic Jacobi rotations (eigen_method::jacobi) are the alternatives. Whichever, the eigenvalues are real and the eigenvectors orthonormal. The eigenvalues are returned in ascending order, with vectors j-th column the eigenvector of values [j] (A = V Λ Vᵀ). Real symmetric only (the complex Hermitian case is hermitian_eigen). Only the lower triangle is read, as numpy.linalg.eigh reads it by default: the upper one is taken to mirror it.
Definition at line 4401 of file decomposition.hpp.
|
inlineexplicit |
Diagonalises input.
| [in] | input | A real symmetric matrix (its lower triangle is read). |
| [in] | method | The algorithm. |
| dimension_error | If input is not square. |
| convergence_error | If the method did not converge within its bound. |
Definition at line 4412 of file decomposition.hpp.
|
inlineprivate |
Sorts the eigenvalues diagonal ascending and reorders v's columns to match.
Definition at line 4498 of file decomposition.hpp.
The eigenvalues, ascending.
Definition at line 4478 of file decomposition.hpp.
The eigenvectors, moved out of an expiring decomposition.
Definition at line 4490 of file decomposition.hpp.
The eigenvectors as columns, ordered to match values.
Definition at line 4484 of file decomposition.hpp.
|
private |
The matrix order.
Definition at line 4521 of file decomposition.hpp.
Eigenvalues, ascending.
Definition at line 4522 of file decomposition.hpp.
Eigenvectors as columns.
Definition at line 4523 of file decomposition.hpp.