Skip to content
Next Next commit
fix invalid variable usages from wrapper outputs
  • Loading branch information
Benjamin Greiner
Benjamin Greiner committed Aug 10, 2019
commit 5896144d75c33c4cef9f55f3703d88f518008fd5
9 changes: 6 additions & 3 deletions slycot/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# MA 02110-1301, USA.

from . import _wrapper
import warnings

def mc01td(dico,dp,p):
""" dp,stable,nz = mc01td(dico,dp,p)
Expand Down Expand Up @@ -62,11 +63,11 @@ def mc01td(dico,dp,p):
e.info = out[-1]
raise e
if out[-1] == 1:
warings.warn('entry P(x) is the zero polynomial.')
warnings.warn('entry P(x) is the zero polynomial.')
if out[-1] == 2:
warings.warn('P(x) may have zeros very close to stability boundary.')
warnings.warn('P(x) may have zeros very close to stability boundary.')
if out[-2] > 0:
warnings.warn('The degree of P(x) has been reduced to %i' %(dp-k))
warnings.warn('The degree of P(x) has been reduced to %i' %(dp-out[-2]))
return out[:-2]


Expand Down Expand Up @@ -138,6 +139,7 @@ def mb05md(a, delta, balanc='N'):
'y','ldy'+hidden,'valr','vali',
'iwork'+hidden,'dwork'+hidden,'ldwork'+hidden,'info'+hidden]
out = _wrapper.mb05md(balanc=balanc,n=min(a.shape),delta=delta,a=a)
n = out[-4]
if out[-1] == 0:
return out[:-1]
elif out[-1] < 0:
Expand Down Expand Up @@ -187,6 +189,7 @@ def mb05nd(a, delta, tol=1e-7):
'exint', 'ldexin'+hidden, 'tol', 'iwork'+hidden,
'dwork'+hidden, 'ldwork'+hidden]
out = _wrapper.mb05nd(n=min(a.shape), delta=delta, a=a, tol=tol)
n = out[-4]
if out[-1] == 0:
return out[:-1]
elif out[-1] < 0:
Expand Down
8 changes: 4 additions & 4 deletions slycot/synthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,20 +690,20 @@ def sb02od(n,m,A,B,Q,R,dico,p=None,L=None,fact='N',uplo='U',sort='S',tol=0.0,ldw
out = _wrapper.sb02od_n(dico,n,m,A,B,Q,R,L,uplo=uplo,jobl=jobl,sort=sort,tol=tol,ldwork=ldwork)
if fact == 'C':
if p is None:
p = shape(Q)[0]
p = _np.shape(Q)[0]
out = _wrapper.sb02od_c(dico,n,m,p,A,B,Q,R,L,uplo=uplo,jobl=jobl,sort=sort,tol=tol,ldwork=ldwork)
if fact == 'D':
if p is None:
p = shape(R)[0]
p = _np.shape(R)[0]
out = _wrapper.sb02od_d(dico,n,m,p,A,B,Q,R,L,uplo=uplo,jobl=jobl,sort=sort,tol=tol,ldwork=ldwork)
if fact == 'B':
if p is None:
p = shape(Q)[0]
p = _np.shape(Q)[0]
out = _wrapper.sb02od_b(dico,n,m,p,A,B,Q,R,L,uplo=uplo,jobl=jobl,sort=sort,tol=tol,ldwork=ldwork)
if out[-1] < 0:
error_text = "The following argument had an illegal value: "+arg_list[-out[-1]-1]
e = ValueError(error_text)
e.info = info
e.info = out[-1]
raise e
if out[-1] == 1:
e = ValueError('the computed extended matrix pencil is singular, possibly due to rounding errors')
Expand Down
4 changes: 2 additions & 2 deletions slycot/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ def td04ad(rowcol,m,p,index,dcoeff,ucoeff,tol=0.0,ldwork=None):

kdcoef = max(index)+1
if rowcol == 'R':
porm = p
# porm = p
Comment thread
bnavigator marked this conversation as resolved.
Outdated
if ucoeff.ndim != 3:
e = ValueError("The numerator is not a 3D array!")
e.info = -7
Expand All @@ -665,7 +665,7 @@ def td04ad(rowcol,m,p,index,dcoeff,ucoeff,tol=0.0,ldwork=None):
raise e
out = _wrapper.td04ad_r(m,p,index,dcoeff,ucoeff,n,tol,ldwork)
elif rowcol == 'C':
porm = m
# porm = m
if ucoeff.ndim != 3:
e = ValueError("The numerator is not a 3D array!")
e.info = -7
Expand Down