qz

QZ (generalized Schur) factorization of a pair of square matrices.

Category: Mathematics > Linear Algebra

Syntax

[AA, BB, Q, Z] = qz(A, B)

Returns upper quasi-triangular AA and upper triangular BB with Q*A*Z = AA and Q*B*Z = BB.

[AA, BB, Q, Z] = qz(A, B, 'complex')

Forces the complex form, in which AA is fully upper triangular.

Description

The QZ algorithm is the generalized counterpart of the Schur decomposition, and it is the basis for computing generalized eigenvalues A*x = lambda*B*x. It works even when B is singular, in which case some eigenvalues are infinite.

In the real form, complex-conjugate eigenvalue pairs appear as 2-by-2 blocks on the diagonal of AA.

Input arguments

A, B
Square matrices of the same size.

Output arguments

AA, BB
The reduced matrices. The generalized eigenvalues are the ratios diag(AA)./diag(BB).
Q, Z
Unitary transformation matrices.

Example

Generalized eigenvalues

A = [1 2; 3 4];
B = [5 6; 7 8];
[AA, BB, Q, Z] = qz(A, B);
norm(Q*A*Z - AA) < 1e-10
sort(eig(A, B))'
Output
ans = logical
   1
ans = 1×2

   -0.3723    5.3723

See also

eig schur ordqz balance