#### Previous topic

scipy.linalg.qz

#### Next topic

scipy.linalg.schur

# scipy.linalg.ordqz

`scipy.linalg.``ordqz`(A, B, sort='lhp', output='real', overwrite_a=False, overwrite_b=False, check_finite=True)

  QZ decomposition for a pair of matrices with reordering.

  New in version 0.17.0.

  Parameters:

  A : (N, N) array_like

  > 2d array to decompose

  B : (N, N) array_like

  > 2d array to decompose

  sort : {callable, ‘lhp’, ‘rhp’, ‘iuc’, ‘ouc’}, optional

  > Specifies whether the upper eigenvalues should be sorted. A callable may be passed that, given a eigenvalue, returns a boolean denoting whether the eigenvalue should be sorted to the top-left (True). For real matrix pairs, the sort function takes three real arguments (alphar, alphai, beta). The eigenvalue `x = (alphar + alphai*1j)/beta`. For complex matrix pairs or output=’complex’, the sort function takes two complex arguments (alpha, beta). The eigenvalue `x = (alpha/beta)`. 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)

  output : str {‘real’,’complex’}, optional

  > Construct the real or complex QZ decomposition for real matrices. Default is ‘real’.

  overwrite_a : bool, optional

  > If True, the contents of A are overwritten.

  overwrite_b : bool, optional

  > If True, the contents of B are overwritten.

  check_finite : bool, optional

  > If true checks the elements of A and B are finite numbers. If false does no checking and passes matrix through to underlying algorithm.

  Returns:

  AA : (N, N) ndarray

  > Generalized Schur form of A.

  BB : (N, N) ndarray

  > Generalized Schur form of B.

  alpha : (N,) ndarray

  > alpha = alphar + alphai * 1j. See notes.

  beta : (N,) ndarray

  > See notes.

  Q : (N, N) ndarray

  > The left Schur vectors.

  Z : (N, N) ndarray

  > The right Schur vectors.

  See also

  `qz`

  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 j-th eigenvalue is real; if positive, then the `j`-th and `(j+1)`-st eigenvalues are a complex conjugate pair, with `ALPHAI(j+1)` negative.