NumericAL
A header-only C++20 lexer built on REAL
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
numerical::schur_decomposition< T > Class Template Reference

The Schur decomposition A = Z T Zᴴ of a square matrix, as scipy.linalg.schur (LAPACK's dgees/zgees): Z orthogonal (unitary), T upper quasi-triangular for a real A (a complex pair a 2 × 2 block in standard form, its diagonal equal, its off-diagonal of opposite signs), upper triangular for a complex one; T's diagonal (and blocks) holds the eigenvalues. Eigenvalues isolated first by permutations (detail::isolate, dgees's ‘dgebal('P’)), which keepZorthogonal and leave a triangular or block-triangular part no iteration; no diagonal scaling, which would not. \tparam Tdoubleorstd::complex<double>`. More...

#include <eigen.hpp>

Classes

struct  sorted_form
 A decomposition and the count its sort moved first. More...
 

Public Member Functions

 schur_decomposition (const matrix< T > &input)
 Decomposes input.
 
 schur_decomposition (matrix< T > &&input)
 Decomposes input in its own storage, an expiring matrix's elements taken over.
 
template<typename Select >
requires std::predicate<Select&, const std::complex<double>&>
 schur_decomposition (const matrix< T > &input, Select select)
 Decomposes input, then moves the eigenvalues for which select holds to the leading block of T (sort), as scipy.linalg.schur(a, sort=...) (LAPACK's dgees/zgees with a selection).
 
std::vector< std::complex< double > > values () const
 The eigenvalues, in T's order: its diagonal, a real 2 × 2 block a conjugate pair, the positive first.
 
std::size_t reorder (const std::vector< bool > &chosen)
 Moves the eigenvalues whose entries of chosen (one per eigenvalue, in values's order) are set to the leading block of T, in their order, Z turning with them, as LAPACK's trsen (MATLAB's ordschur): a real conjugate pair moves where either of its two is chosen. A = Z T Zᴴ still holds.
 
std::size_t sort (const detail::eigenvalue_selection &select)
 The eigenvalues for which select holds moved to the leading block (reorder), as dgees/zgees sort them:
 
std::size_t leading () const noexcept
 The eigenvalues the selecting constructor moved to the leading block (its sdim); 0 otherwise.
 
const matrix< T > & t () const &noexcept
 T, upper quasi-triangular (real) or triangular (complex).
 
matrix< T > t () &&
 T, moved out of an expiring decomposition.
 
const matrix< T > & z () const &noexcept
 Z, the Schur vectors as columns.
 
matrix< T > z () &&
 Z, moved out of an expiring decomposition.
 

Private Member Functions

 schur_decomposition (sorted_form form)
 The decomposition form holds.
 

Static Private Member Functions

static sorted_form sorted (schur_decomposition s, const detail::eigenvalue_selection &select)
 s sorted by select (sort), taken apart for the constructor that holds the count.
 

Private Attributes

matrix< T > t_
 The Schur form.
 
matrix< T > z_
 The Schur vectors.
 
std::size_t leading_ {0}
 The eigenvalues the selecting constructor moved first.
 

Detailed Description

template<double_field T>
class numerical::schur_decomposition< T >

The Schur decomposition A = Z T Zᴴ of a square matrix, as scipy.linalg.schur (LAPACK's dgees/zgees): Z orthogonal (unitary), T upper quasi-triangular for a real A (a complex pair a 2 × 2 block in standard form, its diagonal equal, its off-diagonal of opposite signs), upper triangular for a complex one; T's diagonal (and blocks) holds the eigenvalues. Eigenvalues isolated first by permutations (detail::isolate, dgees's ‘dgebal('P’)), which keepZorthogonal and leave a triangular or block-triangular part no iteration; no diagonal scaling, which would not. \tparam Tdoubleorstd::complex<double>`.

Definition at line 3500 of file eigen.hpp.

Constructor & Destructor Documentation

◆ schur_decomposition() [1/4]

template<double_field T>
numerical::schur_decomposition< T >::schur_decomposition ( const matrix< T > &  input)
inlineexplicit

Decomposes input.

Exceptions
dimension_errorIf input is not square.
non_finite_errorIf an entry is infinite or NaN.
convergence_errorIf the QR iterations did not converge.

Definition at line 3510 of file eigen.hpp.

◆ schur_decomposition() [2/4]

template<double_field T>
numerical::schur_decomposition< T >::schur_decomposition ( matrix< T > &&  input)
inlineexplicit

Decomposes input in its own storage, an expiring matrix's elements taken over.

Definition at line 3515 of file eigen.hpp.

◆ schur_decomposition() [3/4]

template<double_field T>
template<typename Select >
requires std::predicate<Select&, const std::complex<double>&>
numerical::schur_decomposition< T >::schur_decomposition ( const matrix< T > &  input,
Select  select 
)
inline

Decomposes input, then moves the eigenvalues for which select holds to the leading block of T (sort), as scipy.linalg.schur(a, sort=...) (LAPACK's dgees/zgees with a selection).

Exceptions
dimension_errorIf input is not square.
non_finite_errorIf an entry is infinite or NaN.
convergence_errorIf the QR iterations did not converge, or as sort.

Definition at line 3561 of file eigen.hpp.

◆ schur_decomposition() [4/4]

template<double_field T>
numerical::schur_decomposition< T >::schur_decomposition ( sorted_form  form)
inlineexplicitprivate

The decomposition form holds.

Definition at line 3668 of file eigen.hpp.

Member Function Documentation

◆ leading()

template<double_field T>
std::size_t numerical::schur_decomposition< T >::leading ( ) const
inlinenoexcept

The eigenvalues the selecting constructor moved to the leading block (its sdim); 0 otherwise.

Definition at line 3620 of file eigen.hpp.

◆ reorder()

template<double_field T>
std::size_t numerical::schur_decomposition< T >::reorder ( const std::vector< bool > &  chosen)
inline

Moves the eigenvalues whose entries of chosen (one per eigenvalue, in values's order) are set to the leading block of T, in their order, Z turning with them, as LAPACK's trsen (MATLAB's ordschur): a real conjugate pair moves where either of its two is chosen. A = Z T Zᴴ still holds.

Returns
The eigenvalues moved.
Exceptions
dimension_errorIf chosen does not hold one entry per eigenvalue.
convergence_errorIf two blocks were too close to exchange.

Definition at line 3580 of file eigen.hpp.

◆ sort()

template<double_field T>
std::size_t numerical::schur_decomposition< T >::sort ( const detail::eigenvalue_selection &  select)
inline

The eigenvalues for which select holds moved to the leading block (reorder), as dgees/zgees sort them:

Returns
their count, sdim, a real pair counted twice where either of its two is selected.
Exceptions
convergence_errorIf two blocks were too close to exchange, or (real) the rounding of the exchanges left a selected eigenvalue past one not selected, as dgees's info n + 1 and n + 2.

Definition at line 3608 of file eigen.hpp.

◆ sorted()

template<double_field T>
static sorted_form numerical::schur_decomposition< T >::sorted ( schur_decomposition< T >  s,
const detail::eigenvalue_selection &  select 
)
inlinestaticprivate

s sorted by select (sort), taken apart for the constructor that holds the count.

Definition at line 3660 of file eigen.hpp.

◆ t() [1/2]

template<double_field T>
matrix< T > numerical::schur_decomposition< T >::t ( ) &&
inline

T, moved out of an expiring decomposition.

Definition at line 3632 of file eigen.hpp.

◆ t() [2/2]

template<double_field T>
const matrix< T > & numerical::schur_decomposition< T >::t ( ) const &
inlinenoexcept

T, upper quasi-triangular (real) or triangular (complex).

Definition at line 3626 of file eigen.hpp.

◆ values()

template<double_field T>
std::vector< std::complex< double > > numerical::schur_decomposition< T >::values ( ) const
inline

The eigenvalues, in T's order: its diagonal, a real 2 × 2 block a conjugate pair, the positive first.

Definition at line 3567 of file eigen.hpp.

◆ z() [1/2]

template<double_field T>
matrix< T > numerical::schur_decomposition< T >::z ( ) &&
inline

Z, moved out of an expiring decomposition.

Definition at line 3644 of file eigen.hpp.

◆ z() [2/2]

template<double_field T>
const matrix< T > & numerical::schur_decomposition< T >::z ( ) const &
inlinenoexcept

Z, the Schur vectors as columns.

Definition at line 3638 of file eigen.hpp.

Member Data Documentation

◆ leading_

template<double_field T>
std::size_t numerical::schur_decomposition< T >::leading_ {0}
private

The eigenvalues the selecting constructor moved first.

Definition at line 3676 of file eigen.hpp.

◆ t_

template<double_field T>
matrix<T> numerical::schur_decomposition< T >::t_
private

The Schur form.

Definition at line 3674 of file eigen.hpp.

◆ z_

template<double_field T>
matrix<T> numerical::schur_decomposition< T >::z_
private

The Schur vectors.

Definition at line 3675 of file eigen.hpp.


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