# bdqz

Block-diagonal QZ decomposition

Since R2023b

## Syntax

``[AA,BB,TL,TR,blks] = bdqz(A,B,condmax)``
``[AA,BB,TL,TR] = bdqz(A,B,[],blks)``

## Description

example

````[AA,BB,TL,TR,blks] = bdqz(A,B,condmax)` transforms the pair (`A`,`B`) to block-diagonal form.The output matrices `AA`, `BB`, `TL`, and `TR` are such that $AA={T}_{L}^{T}A{T}_{R}$ and $BB={T}_{L}^{T}B{T}_{R}$. `AA` and `BB` are block diagonal and each diagonal pair (`AAj`,`BBj`) is in QZ form:`AAj` is quasi upper-triangular (real case) or upper-triangular (complex case).`BBj` is upper-triangular with real diagonal.`blks` is a vector containing block sizes down the diagonal. Use `condmax` to specify an upper bound on the condition number of `TL` and `TR`. If you omit `condmax`, `bdqz` uses `1e4` as the upper bound.```
````[AA,BB,TL,TR] = bdqz(A,B,[],blks)` specifies the desired block sizes. For this syntax, the input pair `A` and `B` must be in real or complex QZ form (see `qz`). ```

## Examples

collapse all

This example shows how to perform the block-diagonal QZ decomposition.

Generate random 10-by-10 matrices with real values.

```rng(0) A = randn(10); B = randn(10);```

Perform the block-diagonal QZ decomposition.

```[AA,BB,TL,TR,blks] = bdqz(A,B); AA```
```AA = 10×10 2.2815 0 0 0 0 0 0 0 0 0 0 -1.4630 0 0 0 0 0 0 0 0 0 0 1.0999 0 0 0 0 0 0 0 0 0 0 -1.1764 0 0 0 0 0 0 0 0 0 0 0.3870 0.8050 0 0 0 0 0 0 0 0 -0.5243 0.1540 0 0 0 0 0 0 0 0 0 0 -0.4186 0.6583 0 0 0 0 0 0 0 0 -1.5091 -1.1076 0 0 0 0 0 0 0 0 0 0 0.4881 0.5093 0 0 0 0 0 0 0 0 -0.0768 0.4697 ```
`BB`
```BB = 10×10 0.6842 0 0 0 0 0 0 0 0 0 0 0.4721 0 0 0 0 0 0 0 0 0 0 0.6384 0 0 0 0 0 0 0 0 0 0 0.8556 0 0 0 0 0 0 0 0 0 0 0.6615 0 0 0 0 0 0 0 0 0 0 0.5652 0 0 0 0 0 0 0 0 0 0 2.9601 0 0 0 0 0 0 0 0 0 0 1.4418 0 0 0 0 0 0 0 0 0 0 0.8740 0 0 0 0 0 0 0 0 0 0 0.8314 ```
`blks`
```blks = 7×1 1 1 1 1 2 2 2 ```

`bdqz` returns diagonal `AA` and `BB`. The size of the blocks in this decomposition is either 1-by-1 or 2-by-2.

## Input Arguments

collapse all

Input matrices, specified as matrices with real or complex values.

Complex Number Support: Yes

Upper bound on condition number, of `TL` and `TR` matrices, specified as a positive scalar greater than `1`. If you omit this argument, `bdqz` uses `1e4` as the upper bound.

Use `condmax` to control the trade off between block size and accuracy of the decomposition. The larger `condmax` is, the smaller the blocks are, but TL and TR can become more ill-conditioned.

## Output Arguments

collapse all

Block diagonal matrices, returned as matrices with real or complex values.

For real matrices `A` and `B`, all the diagonal blocks of `AA` and `BB` pair are real. For complex matrices `A` and `B`, each block of `AA` and `BB` is associated with a cluster of nearby eigenvalues.

For diagonalizable `A` and `B`, `AA` and `BB` are diagonal.

Block-diagonalizing transformation, returned as matrices.

`bdqz` transforms `A,B` to `AA,BB` such that $AA={T}_{L}^{T}A{T}_{R}$ and $BB={T}_{L}^{T}B{T}_{R}$.

Block sizes in the block-diagonal decomposition, returned as a vector.

## Version History

Introduced in R2023b