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! — Functionbalance!(A; scale=true, permute=true) => Abal, B::BalancerBalance 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.
Converting a real quasi-Schur to a true complex Schur object
GenericSchur.triangularize — Functiontriangularize(S::Schur{T}) => Schur{complex{T})convert a (standard-form) quasi-triangular real Schur factorization into a triangular complex Schur factorization.
Obtaining eigenvectors from a decomposition
LinearAlgebra.eigvecs — Methodeigvecs(S::Schur; left=false) -> Matrix
eigvecs(S::GeneralizedSchur; left=false) -> MatrixCompute 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).
Eigenvalue condition numbers
GenericSchur.eigvalscond — Functioneigvalscond(S::Schur,nsub::Integer) => RealEstimate 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.
eigvalscond(S::GeneralizedSchur, nsub) => pl, prcompute 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.
Subspace conditioning
GenericSchur.subspacesep — Functionsubspacesep(S::Schur,nsub::Integer) => RealEstimate 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.
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! — Functiongschur!(A::StridedMatrix) -> F::Schur
Destructive version of gschur (q.v.).
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.
GenericSchur.gschur — Functiongschur(A::StridedMatrix) -> F::Schur
Computes the Schur factorization of matrix A using a generic implementation. See LinearAlgebra.schur for usage.
GenericSchur.ggschur! — Functionggschur!(A, B) -> S::GeneralizedSchur
Computes the generalized Schur factorization of matrix pair A,B using a generic implementation. Overwrites A and B.
Eigenvectors
GenericSchur.geigen! — Functiongeigen!(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!.
GenericSchur.geigvecs — Functiongeigvecs(S; left::Bool = false)
Compute eigenvectors from a Schur (or generalized Schur) decomposition S. Left eigenvectors are produced if so specified, otherwise right ones.
Reordering a Schur factorization
GenericSchur.gordschur! — Functiongordschur!(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!.
Locally defined exceptions
Note: these are currently peculiar to this package but replacement by upstream analogues will not be considered breaking.
GenericSchur.IllConditionException — TypeIllConditionExceptionException 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.
GenericSchur.UnconvergedException — TypeUnconvergedExceptionException thrown when an iterative algorithm does not converge within the allowed number of steps.
Preference handling
GenericSchur.set_piracy! — Functionset_piracy!(::Bool)Convenience wrapper for determining whether piratical LinearAlgebra methods will be implemented by GenericSchur for future Julia sessions. Uses Preferences.