|
NumericAL
A header-only C++20 lexer built on REAL
|
The eigenvalues, and optionally the right eigenvectors, of a general square matrix, as numpy.linalg.eig.
More...
#include <eigen.hpp>
Public Member Functions | |
| eigen_decomposition (const matrix< T > &input, bool vectors=true) | |
Decomposes input. | |
| const vector< std::complex< double > > & | values () const noexcept |
| The eigenvalues, in the order of the Schur form. | |
| const matrix< std::complex< double > > & | vectors () const &noexcept |
| The eigenvectors as columns, ordered to match values (empty where they were not computed). | |
| matrix< std::complex< double > > | vectors () && |
| The eigenvectors, moved out of an expiring decomposition. | |
| bool | real () const noexcept |
| Whether every eigenvalue is real (a real matrix's whose Schur form has no 2 × 2 block): its vectors are then real too. | |
Private Member Functions | |
| void | finish (std::complex< double > *row, const std::complex< double > &value, double) const |
Normalises the eigenvector row (a row of Vᵀ) of a real matrix's eigenvalue value, as dgeev: a real one to unit norm; a pair's first to unit norm, its largest component real, its second the first's conjugate (the row above). | |
| void | finish (std::complex< double > *row, const std::complex< double > &, const std::complex< double > &) const |
Normalises the eigenvector row of a complex matrix, as zgeev: to unit norm, its largest component real and positive. | |
Private Attributes | |
| std::size_t | n_ |
| The matrix order. | |
| vector< std::complex< double > > | values_ |
| The eigenvalues. | |
| matrix< std::complex< double > > | vectors_ |
| The eigenvectors as columns. | |
| bool | real_ {true} |
| Whether all eigenvalues are real. | |
The eigenvalues, and optionally the right eigenvectors, of a general square matrix, as numpy.linalg.eig.
T is double or std::complex<double>; the eigenvalues and vectors are complex either way (real says whether a real matrix's are all real). Column j of vectors is the eigenvector of values [j], A V = V Λ, each of unit norm with its component of largest modulus real.
|
inlineexplicit |
Decomposes input.
| [in] | input | A square matrix. |
| [in] | vectors | Whether to compute the eigenvectors (the eigenvalues alone cost a third as much). |
| dimension_error | If input is not square. |
| non_finite_error | If an entry is infinite or NaN. |
| convergence_error | If the QR iterations did not converge. |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
|
private |
|
private |
|
private |