QZ decompostion for generalized eigenvalues of a pair of matrices.
The QZ, or generalized Schur, decomposition for a pair of N x N nonsymmetric matrices (A,B) is:
(A,B) = (Q*AA*Z', Q*BB*Z')
where AA, BB is in generalized Schur form if BB is upper-triangular with non-negative diagonal and AA is upper-triangular, or for real QZ decomposition (output='real') block upper triangular with 1x1 and 2x2 blocks. In this case, the 1x1 blocks correspond to real generalized eigenvalues and 2x2 blocks are ‘standardized’ by making the corresponding elements of BB have the form:
[ a 0 ]
[ 0 b ]
and the pair of corresponding 2x2 blocks in AA and BB will have a complex conjugate pair of generalized eigenvalues. If (output='complex') or A and B are complex matrices, Z’ denotes the conjugate-transpose of Z. Q and Z are unitary matrices.
New in version 0.11.0.
Parameters : | A : (N, N) array_like
B : (N, N) array_like
output : str {‘real’,’complex’}
lwork : int, optional
sort : {None, callable, ‘lhp’, ‘rhp’, ‘iuc’, ‘ouc’}, optional
check_finite : boolean
|
---|---|
Returns : | AA : (N, N) ndarray
BB : (N, N) ndarray
Q : (N, N) ndarray
Z : (N, N) ndarray
sdim : int, optional
|
Notes
Q is transposed versus the equivalent function in Matlab.
Examples
>>> from scipy import linalg
>>> np.random.seed(1234)
>>> A = np.arange(9).reshape((3, 3))
>>> B = np.random.randn(3, 3)
>>> AA, BB, Q, Z = linalg.qz(A, B)
>>> AA
array([[-13.40928183, -4.62471562, 1.09215523],
[ 0. , 0. , 1.22805978],
[ 0. , 0. , 0.31973817]])
>>> BB
array([[ 0.33362547, -1.37393632, 0.02179805],
[ 0. , 1.68144922, 0.74683866],
[ 0. , 0. , 0.9258294 ]])
>>> Q
array([[ 0.14134727, -0.97562773, 0.16784365],
[ 0.49835904, -0.07636948, -0.86360059],
[ 0.85537081, 0.20571399, 0.47541828]])
>>> Z
array([[-0.24900855, -0.51772687, 0.81850696],
[-0.79813178, 0.58842606, 0.12938478],
[-0.54861681, -0.6210585 , -0.55973739]])