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::generalized_schur Class Reference

The generalized Schur decomposition of a complex pencil A − λ B, A = Q S Zᴴ and B = Q T Zᴴ, as scipy.linalg.qz(a, b, output="complex") (LAPACK's zgges): Q and Z unitary, S and T upper triangular, T's diagonal real and non-negative; the generalized eigenvalues α_k / β_k on the diagonals (β_k = 0 an infinite one). Reordered as scipy.linalg.ordqz by sort or reorder. Each operand is first brought into the range [√safmin / ε, ε / √safmin] of its largest magnitude where it lies outside, as zgges scales it, and the form and the eigenvalues taken back. More...

#include <generalized.hpp>

Collaboration diagram for numerical::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.
 

Public Member Functions

 generalized_schur (const matrix< std::complex< double > > &a, const matrix< std::complex< double > > &b)
 Decomposes the pencil of a and b.
 
 generalized_schur (const matrix< std::complex< double > > &a, const matrix< std::complex< double > > &b, std::size_t steps)
 Decomposes the pencil within steps QZ iterations (zhgeqz's bound 30 n by default).
 
matrix< std::complex< double > > s () const
 S, upper triangular.
 
matrix< std::complex< double > > t () const
 T, upper triangular, its diagonal real and non-negative.
 
matrix< std::complex< double > > q () const
 Q, unitary: A = Q S Zᴴ.
 
matrix< std::complex< double > > z () const
 Z, unitary.
 
const std::vector< std::pair< std::complex< double >, std::complex< double > > > & values () const noexcept
 The eigenvalues as (α, β), in the diagonals' order: α = S(k, k), β = T(k, k).
 
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 ztgsen (by ztgexc's exchanges), Q and Z turning with them, T's diagonal made real and non-negative again.
 
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< std::pair< std::complex< double >, std::complex< double > > > unscaled (std::vector< std::pair< std::complex< double >, std::complex< double > > > raw) const
 The eigenvalues of the scaled form raw taken back: α by A's factor, β by B's.
 

Private Attributes

detail::qz_form form_
 S, T, Q and Z, of the scaled pencil.
 
std::vector< std::pair< std::complex< double >, std::complex< double > > > values_
 The eigenvalues as (α, β).
 
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 Schur decomposition of a complex pencil A − λ B, A = Q S Zᴴ and B = Q T Zᴴ, as scipy.linalg.qz(a, b, output="complex") (LAPACK's zgges): Q and Z unitary, S and T upper triangular, T's diagonal real and non-negative; the generalized eigenvalues α_k / β_k on the diagonals (β_k = 0 an infinite one). Reordered as scipy.linalg.ordqz by sort or reorder. Each operand is first brought into the range [√safmin / ε, ε / √safmin] of its largest magnitude where it lies outside, as zgges scales it, and the form and the eigenvalues taken back.

Definition at line 2174 of file generalized.hpp.

Member Typedef Documentation

◆ selection

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

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

Definition at line 2179 of file generalized.hpp.

Constructor & Destructor Documentation

◆ generalized_schur() [1/2]

numerical::generalized_schur::generalized_schur ( const matrix< std::complex< double > > &  a,
const matrix< std::complex< 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 2187 of file generalized.hpp.

◆ generalized_schur() [2/2]

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

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

Definition at line 2195 of file generalized.hpp.

Member Function Documentation

◆ q()

matrix< std::complex< double > > numerical::generalized_schur::q ( ) const
inline

Q, unitary: A = Q S Zᴴ.

Definition at line 2227 of file generalized.hpp.

◆ reorder()

std::size_t numerical::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 ztgsen (by ztgexc's exchanges), Q and Z turning with them, T's diagonal made real and non-negative again.

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

Definition at line 2252 of file generalized.hpp.

◆ s()

matrix< std::complex< double > > numerical::generalized_schur::s ( ) const
inline

S, upper triangular.

Definition at line 2215 of file generalized.hpp.

◆ sort()

std::size_t numerical::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 2282 of file generalized.hpp.

◆ t()

matrix< std::complex< double > > numerical::generalized_schur::t ( ) const
inline

T, upper triangular, its diagonal real and non-negative.

Definition at line 2221 of file generalized.hpp.

◆ unscaled()

std::vector< std::pair< std::complex< double >, std::complex< double > > > numerical::generalized_schur::unscaled ( std::vector< std::pair< std::complex< double >, std::complex< double > > >  raw) const
inlineprivate

The eigenvalues of the scaled form raw taken back: α by A's factor, β by B's.

Definition at line 2294 of file generalized.hpp.

◆ values()

const std::vector< std::pair< std::complex< double >, std::complex< double > > > & numerical::generalized_schur::values ( ) const
inlinenoexcept

The eigenvalues as (α, β), in the diagonals' order: α = S(k, k), β = T(k, k).

Definition at line 2239 of file generalized.hpp.

◆ z()

matrix< std::complex< double > > numerical::generalized_schur::z ( ) const
inline

Z, unitary.

Definition at line 2233 of file generalized.hpp.

Member Data Documentation

◆ a_back_

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

The factor taking S back to A's scale.

Definition at line 2306 of file generalized.hpp.

◆ b_back_

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

T's.

Definition at line 2307 of file generalized.hpp.

◆ form_

detail::qz_form numerical::generalized_schur::form_
private

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

Definition at line 2304 of file generalized.hpp.

◆ values_

std::vector<std::pair<std::complex<double>, std::complex<double> > > numerical::generalized_schur::values_
private

The eigenvalues as (α, β).

Definition at line 2305 of file generalized.hpp.


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