NumericAL
A header-only C++20 lexer built on REAL
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
numerical::symmetric_eigen Class Reference

The eigenvalues and eigenvectors of a real symmetric matrix. More...

#include <decomposition.hpp>

Collaboration diagram for numerical::symmetric_eigen:
[legend]

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ symmetric_eigen()

numerical::symmetric_eigen::symmetric_eigen ( const matrix< double > &  input,
eigen_method  method = eigen_method::divide_and_conquer 
)
inlineexplicit

Diagonalises input.

Parameters
[in]inputA real symmetric matrix (its lower triangle is read).
[in]methodThe algorithm.
Exceptions
dimension_errorIf input is not square.
convergence_errorIf the method did not converge within its bound.

Definition at line 4412 of file decomposition.hpp.

Member Function Documentation

◆ extract_sorted()

void numerical::symmetric_eigen::extract_sorted ( const buffer< double > &  diagonal,
const buffer< double > &  v 
)
inlineprivate

Sorts the eigenvalues diagonal ascending and reorders v's columns to match.

Definition at line 4498 of file decomposition.hpp.

◆ values()

const vector< double > & numerical::symmetric_eigen::values ( ) const
inlinenoexcept

The eigenvalues, ascending.

Definition at line 4478 of file decomposition.hpp.

◆ vectors() [1/2]

matrix< double > numerical::symmetric_eigen::vectors ( ) &&
inline

The eigenvectors, moved out of an expiring decomposition.

Definition at line 4490 of file decomposition.hpp.

◆ vectors() [2/2]

const matrix< double > & numerical::symmetric_eigen::vectors ( ) const &
inlinenoexcept

The eigenvectors as columns, ordered to match values.

Definition at line 4484 of file decomposition.hpp.

Member Data Documentation

◆ n_

std::size_t numerical::symmetric_eigen::n_
private

The matrix order.

Definition at line 4521 of file decomposition.hpp.

◆ values_

vector<double> numerical::symmetric_eigen::values_
private

Eigenvalues, ascending.

Definition at line 4522 of file decomposition.hpp.

◆ vectors_

matrix<double> numerical::symmetric_eigen::vectors_
private

Eigenvectors as columns.

Definition at line 4523 of file decomposition.hpp.


The documentation for this class was generated from the following file: