API

Most of the user-facing methods are extensions of functions declared in LinearAlgebra: eigen!, schur!, ordschur!, eigvals!.

Additional public functions are as follows.

Balancing

GenericSchur.balance!Function
balance!(A; scale=true, permute=true) => Abal, B::Balancer

Balance a square matrix so that various operations are more stable.

If permute, then row and column permutations are found such that Abal has the block form [T₁ X Y; 0 C Z; 0 0 T₂] where T₁ and T₂ are upper-triangular. If scale, then a diagonal similarity transform using powers of 2 is found such that the 1-norm of the C block (or the whole of Abal, if not permuting) is near unity. The transformations are encoded into B so that they can be inverted for eigenvectors, etc. Balancing typically improves the accuracy of eigen-analysis.

source

Converting a real quasi-Schur to a true complex Schur object

GenericSchur.triangularizeFunction
triangularize(S::Schur{T}) => Schur{complex{T})

convert a (standard-form) quasi-triangular real Schur factorization into a triangular complex Schur factorization.

source

Obtaining eigenvectors from a decomposition

LinearAlgebra.eigvecsMethod
eigvecs(S::Schur; left=false) -> Matrix
eigvecs(S::GeneralizedSchur; left=false) -> Matrix

Compute right or left eigenvectors from a Schur decomposition. Eigenvectors are returned as columns of a matrix, ordered to match S.values.

For standard Schur, the returned eigenvectors have unit Euclidean norm, and the largest elements are real.

For generalized Schur, each vector is scaled so the largest element vⱼ satisfies abs(real(vⱼ)) + abs(imag(vⱼ)) = 1 (a convention from LAPACK).

source

Eigenvalue condition numbers

GenericSchur.eigvalscondFunction
eigvalscond(S::Schur,nsub::Integer) => Real

Estimate the reciprocal of the condition number of the nsub leading eigenvalues of S. (Use ordschur to move a subspace of interest to the front of S.)

See the LAPACK User's Guide for details of interpretation.

source
eigvalscond(S::GeneralizedSchur, nsub) => pl, pr

compute approx. reciprocal norms of projectors on left/right subspaces associated w/ leading nsub×nsub block of S. Use ordschur to select eigenvalues of interest.

An approximate bound on avg. absolute error of associated eigenvalues is ϵ * norm(vcat(A,B)) / pl. See LAPACK documentation for further details.

source

Subspace conditioning

GenericSchur.subspacesepFunction
subspacesep(S::Schur,nsub::Integer) => Real

Estimate the reciprocal condition of the separation angle for the invariant subspace corresponding to the leading block of size nsub of a Schur decomposition. (Use ordschur to move a subspace of interest to the front of S.)

See the LAPACK User's Guide for details of interpretation.

source

Non-piratical functions

If one opts out of type piracy, the implementations in GenericSchur are available via the following functions. (Several are not currently exported, but are considered public API.)

Mainly for testing purposes, one can also invoke the generic methods implemented here for LAPACK-compatible matrix types with these.

Schur decomposition

GenericSchur.gschur!Function

gschur!(A::StridedMatrix) -> F::Schur

Destructive version of gschur (q.v.).

source

gschur!(H::Hessenberg, Z) -> F::Schur

Compute the Schur decomposition of a Hessenberg matrix. Subdiagonals of H must be real. If Z is provided, it is updated with the unitary transformations of the decomposition.

source
GenericSchur.gschurFunction

gschur(A::StridedMatrix) -> F::Schur

Computes the Schur factorization of matrix A using a generic implementation. See LinearAlgebra.schur for usage.

source
GenericSchur.ggschur!Function

ggschur!(A, B) -> S::GeneralizedSchur

Computes the generalized Schur factorization of matrix pair A,B using a generic implementation. Overwrites A and B.

source

Eigenvectors

GenericSchur.geigen!Function

geigen!(A, alg=QRIteration(); sortby=eigsortby) -> E::Eigen

Computes the eigen-decomposition of a Hermitian (or real symmetric) matrix A using a generic implementation. Currently alg may be QRIteration() or DivideAndConquer(). Otherwise, similar to LinearAlgebra.eigen!.

source
GenericSchur.geigvecsFunction

geigvecs(S; left::Bool = false)

Compute eigenvectors from a Schur (or generalized Schur) decomposition S. Left eigenvectors are produced if so specified, otherwise right ones.

source

Reordering a Schur factorization

GenericSchur.gordschur!Function

gordschur!(F::Schur, select) -> Schur gordschur!(F::GeneralizedSchur, select) -> GeneralizedSchur

Reorder a Schur decomposition so that the eigenvalues and subspaces corresponding to indices set to true in the Boolean vector (or BitVector) select are first. Uses a generic implementation. C.f. LinearAlgebra.ordschur!.

source

Locally defined exceptions

Note: these are currently peculiar to this package but replacement by upstream analogues will not be considered breaking.

GenericSchur.IllConditionExceptionType
IllConditionException

Exception thrown when argument matrix or matrices are too ill-conditioned for the requested operation. The index field may indicate the block where near-singularity was detected.

source

Preference handling

GenericSchur.set_piracy!Function
set_piracy!(::Bool)

Convenience wrapper for determining whether piratical LinearAlgebra methods will be implemented by GenericSchur for future Julia sessions. Uses Preferences.

source