The Generalized Schur Decomposition

The generalized Schur decomposition or QZ decomposition of a pair of square matrices, A and B simultaneously decomposes the matrices into the form

A = QSZ*,

and

B = QTZ*,

where S and T are upper (quasi-)triangular matrices called the Schur form, and Q and Z are orthogonal (unitary) matrices called the left and right Schur vectors. The diagonals of the matrices S and T contain the generalized eigenvalues of A and B.

The name QZ decomposition derives from this notation for the matrices that simultaneously triangularize A and B.

Working with Generalized Schur Decompositions

Generalized Schur decompositions are represented by the GeneralizedSchurDecomposition<T> class. It has no constructors. Instead, it is created by calling the GetSchurDecomposition method on the primary matrix (A). This method has two overloads. The first overload has one argument: the secondary matrix (B). Both matrices must be square. The second overload takes an additional Boolean argument that specifies whether the contents of the matrices may be destroyed during the calculation of the Schur decomposition.

C#
var A = Matrix.Create(new double[,] { 
    { 2, 5, 8, 7 }, 
    { 5, 2, 2, 8 }, 
    { 7, 5, 6, 6 }, 
    { 5, 4, 4, 1 }
});
var B = Matrix.Create(new double[,] { 
    { 0, 6, 0, 0 },
    { 5, 0, 2, 1 },
    { 5, 2, 6, 6 },
    { 4, 7, 7, 7 } 
});
var qz = A.GetSchurDecomposition(B);

The Decompose method performs the actual decomposition. This method makes a copy of the matrix if necessary. It then calls the appropriate LAPACK routine to perform the actual decomposition. This method is called by other methods as needed. You will rarely need to call it explicitly.

Properties

Because real matrices may have complex eigenvalues and eigenvectors, the generalized Schur decomposition of real matrices deserves some special attention.

Real matrices

The SchurForm1 and SchurForm2 properties return the Schur forms, S and T of the matrices A and B, respectively. LeftSchurVectors and RightSchurVectors properties return the orthogonal (unitary) matrices, Q and Z.

C#
var S = qz.SchurForm1;
var T = qz.SchurForm2;
var Q = qz.LeftSchurVectors;
var Z = qz.RightSchurVectors;

Real matrices can have complex eigenvalues. In this case the Schur form of the first matrix and the Schur vectors will have complex entries. To avoid this, the real Schur form is computed instead. This is a quasi-triangular matrix with 2x2 blocks on the diagonal corresponding to pairs of complex conjugate eigenvalues. The Schur form for the second matrix is always upper triangular.

For real matrices, the Eigenvalues property returns a vector of the real eigenvalues only. To get all eigenvalues, use the ComplexEigenvalues property.

Complex matrices

For complex matrices, both Schur forms are always upper triangular. The Eigenvalues property returns a vector containing the (complex) eigenvalues.

The ComplexEigenvalues property is meaningless for complex Schur decompositions.

Singular secondary matrices

If the secondary matrix B is singular, then one or more of the generalized eigenvalues of the pair is infinite. The generalized eigenvalues can also be returned as pairs whose quotient is the generalized eigenvalue. When the denominator of the quotient is zero, the generalized eigenvalue is infinite.

Three properties give access to the quotient form of the generalized eigenvalues. The EigenvalueDenominators property returns a vector containing the denominators of the quotients. For real matrices, it is always real. The EigenvalueNumerators property returns a vector containing the numerators of the quotients. As with the generalized eigenvalues themselves, this property only returns real numerators for real matrices. To access the the full set of numerators, use the ComplexEigenvalueNumerators property.