Skip to content

Commit

Permalink
FIX: linalg._qz String formatter syntax error (scipy#8178)
Browse files Browse the repository at this point in the history
* FIX: String formatter syntax, add warning stacklevel
  • Loading branch information
ilayn authored Nov 23, 2017
1 parent a143391 commit 5f41f93
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions scipy/linalg/_decomp_qz.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
from numpy import asarray_chkfinite

from .misc import LinAlgError, _datacopied
from .misc import LinAlgError, _datacopied, LinAlgWarning
from .lapack import get_lapack_funcs

from scipy._lib.six import callable
Expand Down Expand Up @@ -126,11 +126,12 @@ def _qz(A, B, output='real', lwork=None, sort=None, overwrite_a=False,

info = result[-1]
if info < 0:
raise ValueError("Illegal value in argument %d of gges" % -info)
raise ValueError("Illegal value in argument {} of gges".format(-info))
elif info > 0 and info <= a_n:
warnings.warn("The QZ iteration failed. (a,b) are not in Schur "
"form, but ALPHAR(j), ALPHAI(j), and BETA(j) should be "
"correct for J=%d,...,N" % info-1, UserWarning)
"correct for J={},...,N".format(info-1), LinAlgWarning,
stacklevel=3)
elif info == a_n+1:
raise LinAlgError("Something other than QZ iteration failed")
elif info == a_n+2:
Expand Down Expand Up @@ -334,15 +335,15 @@ def ordqz(A, B, sort='lhp', output='real', overwrite_a=False,
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.
real; if positive, then the ``j``-th and ``(j+1)``-st eigenvalues are a
complex conjugate pair, with ``ALPHAI(j+1)`` negative.
See also
--------
qz
"""
#NOTE: should users be able to set these?
# NOTE: should users be able to set these?
lwork = None
result, typ = _qz(A, B, output=output, lwork=lwork, sort=None,
overwrite_a=overwrite_a, overwrite_b=overwrite_b,
Expand Down

0 comments on commit 5f41f93

Please sign in to comment.