bundles / scipy 1.17.1 / scipy / linalg / _decomp_qz / ordqz
function
scipy.linalg._decomp_qz:ordqz
source: /scipy/linalg/_decomp_qz.py :322
Signature
def ordqz ( A , B , sort = lhp , output = real , overwrite_a = False , overwrite_b = False , check_finite = True ) Summary
QZ decomposition for a pair of matrices with reordering.
Extended Summary
The documentation is written assuming array arguments are of specified "core" shapes. However, array argument(s) of this function may have additional "batch" dimensions prepended to the core shape. In this case, the array is treated as a batch of lower-dimensional slices; see linalg_batch for details. Note that calls with zero-size batches are unsupported and will raise a ValueError.
Parameters
A: (N, N) array_like2-D array to decompose
B: (N, N) array_like2-D array to decompose
sort: {callable, 'lhp', 'rhp', 'iuc', 'ouc'}, optionalSpecifies whether the upper eigenvalues should be sorted. A callable may be passed that, given an ordered pair
(alpha, beta)representing the eigenvaluex = (alpha/beta), returns a boolean denoting whether the eigenvalue should be sorted to the top-left (True). For the real matrix pairsbetais real whilealphacan be complex, and for complex matrix pairs bothalphaandbetacan be complex. The callable must be able to accept a NumPy array. Alternatively, string parameters may be used:'lhp' Left-hand plane (x.real < 0.0)
'rhp' Right-hand plane (x.real > 0.0)
'iuc' Inside the unit circle (x*x.conjugate() < 1.0)
'ouc' Outside the unit circle (x*x.conjugate() > 1.0)
With the predefined sorting functions, an infinite eigenvalue (i.e.,
alpha != 0andbeta = 0) is considered to lie in neither the left-hand nor the right-hand plane, but it is considered to lie outside the unit circle. For the eigenvalue(alpha, beta) = (0, 0), the predefined sorting functions all returnFalse.output: str {'real','complex'}, optionalConstruct the real or complex QZ decomposition for real matrices. Default is 'real'.
overwrite_a: bool, optionalIf True, the contents of A are overwritten.
overwrite_b: bool, optionalIf True, the contents of B are overwritten.
check_finite: bool, optionalIf true checks the elements of
AandBare finite numbers. If false does no checking and passes matrix through to underlying algorithm.
Returns
AA: (N, N) ndarrayGeneralized Schur form of A.
BB: (N, N) ndarrayGeneralized Schur form of B.
alpha: (N,) ndarrayalpha = alphar + alphai * 1j. See notes.
beta: (N,) ndarraySee notes.
Q: (N, N) ndarrayThe left Schur vectors.
Z: (N, N) ndarrayThe right Schur vectors.
Notes
On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,...,N, will be the generalized eigenvalues. ALPHAR(j) + ALPHAI(j)*i and BETA(j),j=1,...,N are the diagonals of the complex Schur form (S,T) that would result if the 2-by-2 diagonal blocks of the real generalized Schur form of (A,B) were further reduced to triangular form using complex unitary transformations. If ALPHAI(j) is zero, then the jth eigenvalue is real; if positive, then the jth and (j+1)st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) negative.
Examples
import numpy as np from scipy.linalg import ordqz A = np.array([[2, 5, 8, 7], [5, 2, 2, 8], [7, 5, 6, 6], [5, 4, 4, 8]]) B = np.array([[0, 6, 0, 0], [5, 0, 2, 1], [5, 2, 6, 6], [4, 7, 7, 7]]) AA, BB, alpha, beta, Q, Z = ordqz(A, B, sort='lhp')✓
(alpha/beta).real < 0
✗See also
Aliases
-
scipy.linalg.ordqz