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

The generalized real Schur decomposition of a real pencil A − λ B, A = Q S Zᵀ and B = Q T Zᵀ, as scipy.linalg.qz(a, b) (LAPACK's dgges): Q and Z orthogonal, T upper triangular with a non-negative diagonal, S quasi-triangular, a 2 × 2 diagonal block for each conjugate pair of eigenvalues, T diagonal and positive there; the eigenvalues (αr + i αi) / β (β = 0 an infinite one). More...

#include <generalized.hpp>

Collaboration diagram for numerical::real_generalized_schur:
[legend]

Public Types

using selection = std::function< bool(const std::complex< double > &, const std::complex< double > &)>
 The selection scipy.linalg.ordqz takes: true for (α, β) to lead, α = αr + i αi.
 

Public Member Functions

 real_generalized_schur (const matrix< double > &a, const matrix< double > &b)
 Decomposes the pencil of a and b.
 
 real_generalized_schur (const matrix< double > &a, const matrix< double > &b, std::size_t steps)
 Decomposes the pencil within steps QZ iterations (dhgeqz's bound 30 n by default).
 
matrix< double > s () const
 S, quasi-triangular.
 
matrix< double > t () const
 T, upper triangular, its diagonal non-negative.
 
matrix< double > q () const
 Q, orthogonal: A = Q S Zᵀ.
 
matrix< double > z () const
 Z, orthogonal.
 
const std::vector< detail::real_pencil_value > & values () const noexcept
 The eigenvalues as (αr, αi, β), in the diagonal's order.
 
std::size_t reorder (const std::vector< bool > &chosen)
 Moves the eigenvalues whose entries of chosen are set to the leading diagonal places, in their order, as LAPACK's dtgsen (by dtgexc's exchanges of blocks), a conjugate pair moved together where either of its two is chosen; Q and Z turning with them, the eigenvalues recomputed as dtgsen gives them.
 
std::size_t sort (const selection &select)
 The eigenvalues select holds moved first (reorder), as scipy.linalg.ordqz(…, sort=…) sorts them.
 

Private Member Functions

std::vector< detail::real_pencil_value > unscaled (std::vector< detail::real_pencil_value > raw) const
 The eigenvalues of the scaled form raw taken back, as dgges takes them: α by A's factor, β by B's; a conjugate pair whose α or β would leave the range first rescaled as a whole (its ratio kept) to the size of its block's entries. A pair of αr = 0 takes the second test (dgges divides by it).
 

Private Attributes

detail::real_qz_form form_
 S, T, Q and Z, of the scaled pencil.
 
std::vector< detail::real_pencil_value > values_
 The eigenvalues.
 
double a_back_ {1.0}
 The factor taking S back to A's scale.
 
double b_back_ {1.0}
 T's.
 

Detailed Description

The generalized real Schur decomposition of a real pencil A − λ B, A = Q S Zᵀ and B = Q T Zᵀ, as scipy.linalg.qz(a, b) (LAPACK's dgges): Q and Z orthogonal, T upper triangular with a non-negative diagonal, S quasi-triangular, a 2 × 2 diagonal block for each conjugate pair of eigenvalues, T diagonal and positive there; the eigenvalues (αr + i αi) / β (β = 0 an infinite one).

Definition at line 2426 of file generalized.hpp.

Member Typedef Documentation

◆ selection

using numerical::real_generalized_schur::selection = std::function<bool (const std::complex<double>&, const std::complex<double>&)>

The selection scipy.linalg.ordqz takes: true for (α, β) to lead, α = αr + i αi.

Definition at line 2494 of file generalized.hpp.

Constructor & Destructor Documentation

◆ real_generalized_schur() [1/2]

numerical::real_generalized_schur::real_generalized_schur ( const matrix< double > &  a,
const matrix< double > &  b 
)
inline

Decomposes the pencil of a and b.

Exceptions
dimension_errorIf a or b is not square or their orders differ.
non_finite_errorIf an entry is infinite or NaN.
convergence_errorIf the QZ iterations did not converge.

Definition at line 2436 of file generalized.hpp.

◆ real_generalized_schur() [2/2]

numerical::real_generalized_schur::real_generalized_schur ( const matrix< double > &  a,
const matrix< double > &  b,
std::size_t  steps 
)
inline

Decomposes the pencil within steps QZ iterations (dhgeqz's bound 30 n by default).

Definition at line 2444 of file generalized.hpp.

Member Function Documentation

◆ q()

matrix< double > numerical::real_generalized_schur::q ( ) const
inline

Q, orthogonal: A = Q S Zᵀ.

Definition at line 2476 of file generalized.hpp.

◆ reorder()

std::size_t numerical::real_generalized_schur::reorder ( const std::vector< bool > &  chosen)
inline

Moves the eigenvalues whose entries of chosen are set to the leading diagonal places, in their order, as LAPACK's dtgsen (by dtgexc's exchanges of blocks), a conjugate pair moved together where either of its two is chosen; Q and Z turning with them, the eigenvalues recomputed as dtgsen gives them.

Returns
The eigenvalues moved.
Exceptions
dimension_errorIf chosen does not hold one entry per eigenvalue.
convergence_errorIf an exchange is refused (dtgex2's tests: two eigenvalues too close to separate); the decomposition is then unchanged.

Definition at line 2505 of file generalized.hpp.

◆ s()

matrix< double > numerical::real_generalized_schur::s ( ) const
inline

S, quasi-triangular.

Definition at line 2464 of file generalized.hpp.

◆ sort()

std::size_t numerical::real_generalized_schur::sort ( const selection &  select)
inline

The eigenvalues select holds moved first (reorder), as scipy.linalg.ordqz(…, sort=…) sorts them.

Returns
Their count.

Definition at line 2528 of file generalized.hpp.

◆ t()

matrix< double > numerical::real_generalized_schur::t ( ) const
inline

T, upper triangular, its diagonal non-negative.

Definition at line 2470 of file generalized.hpp.

◆ unscaled()

std::vector< detail::real_pencil_value > numerical::real_generalized_schur::unscaled ( std::vector< detail::real_pencil_value >  raw) const
inlineprivate

The eigenvalues of the scaled form raw taken back, as dgges takes them: α by A's factor, β by B's; a conjugate pair whose α or β would leave the range first rescaled as a whole (its ratio kept) to the size of its block's entries. A pair of αr = 0 takes the second test (dgges divides by it).

Definition at line 2544 of file generalized.hpp.

◆ values()

const std::vector< detail::real_pencil_value > & numerical::real_generalized_schur::values ( ) const
inlinenoexcept

The eigenvalues as (αr, αi, β), in the diagonal's order.

Definition at line 2488 of file generalized.hpp.

◆ z()

matrix< double > numerical::real_generalized_schur::z ( ) const
inline

Z, orthogonal.

Definition at line 2482 of file generalized.hpp.

Member Data Documentation

◆ a_back_

double numerical::real_generalized_schur::a_back_ {1.0}
private

The factor taking S back to A's scale.

Definition at line 2582 of file generalized.hpp.

◆ b_back_

double numerical::real_generalized_schur::b_back_ {1.0}
private

T's.

Definition at line 2583 of file generalized.hpp.

◆ form_

detail::real_qz_form numerical::real_generalized_schur::form_
private

S, T, Q and Z, of the scaled pencil.

Definition at line 2580 of file generalized.hpp.

◆ values_

std::vector<detail::real_pencil_value> numerical::real_generalized_schur::values_
private

The eigenvalues.

Definition at line 2581 of file generalized.hpp.


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