MATLAB Function Reference
qz

QZ factorization for generalized eigenvalues

Syntax

• ```[AA,BB,Q,Z,] = qz(A,B)
[AA,BB,Q,Z,V,W] = qz(A,B)
qz(A,B,flag)
```

Description

The `qz` function gives access to intermediate results in the computation of generalized eigenvalues.

```[AA,BB,Q,Z] = qz(A,B) ``` for square matrices `A` and `B`, produces upper quasitriangular matrices `AA` and `BB`, and unitary matrices `Q` and `Z` such that `Q*A*Z = AA`, and `Q*B*Z = BB`. For complex matrices, `AA` and `BB` are triangular.

```[AA,BB,Q,Z,V,W] = qz(A,B) ``` also produces matrices `V` and `W` whose columns are generalized eigenvectors.

```qz(A,B,flag) ``` for real matrices `A` and `B`, produces one of two decompositions depending on the value of `flag`:

 `'complex'` Produces a possibly complex decomposition with a triangular `AA`. For compatibility with earlier versions, `'complex'` is the default. `'real'` Produces a real decomposition with a quasitriangular `AA`, containing 1-by-1 and 2-by-2 blocks on its diagonal.

If `AA` is triangular, the diagonal elements of `AA` and `BB`,

• ```alpha = ```diag(AA)
```beta = ```diag(BB)
``````

are the generalized eigenvalues that satisfy

• ```A*V*diag(beta) = B*V*diag(alpha)
diag(beta)*W'*A = diag(alpha)*W'*B
```

The eigenvalues produced by

• ```lambda = eig(A,B)
```

are the element-wise ratios of `alpha` and `beta`.

• ```lambda = alpha ./ beta
```

If `AA` is not triangular, it is necessary to further reduce the 2-by-2 blocks to obtain the eigenvalues of the full system.

Algorithm

For real QZ on real `A` and real `B`, `eig` uses the LAPACK `DGGES` routine. If you request the fifth output `V`, `eig` also uses `DTGEVC`.

For complex QZ on real or complex `A` and `B`, `eig` uses the LAPACK `ZGGES` routine. If you request the fifth output `V`, `eig` also uses `ZTGEVC`.

`eig`