Skip to content

Commit

Permalink
Update docstrings, add SlycotParameterError and other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
KybernetikJo committed Aug 28, 2023
1 parent fb3e780 commit 370f816
Showing 1 changed file with 45 additions and 8 deletions.
53 changes: 45 additions & 8 deletions slycot/synthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ def sb01bd(n,m,np,alpha,A,B,w,dico,tol=0.0,ldwork=None):
:= 'C': continuous-time system;
:= 'D': discrete-time system.
tol : float, optional
The absolute tolerance level below which the elements of A or B are
considered zero (used for controllability tests).
If tol <= 0 the default value is used.
The absolute tolerance level below which the elements of A or B are
considered zero (used for controllability tests).
If tol <= 0 the default value is used.
Default is `0.0`.
ldwork : int, optional
The length of the cache array. The default value is
max(1,5*m,5*n,2*n+4*m), for optimum performance it should be larger.
Expand Down Expand Up @@ -96,6 +97,8 @@ def sb01bd(n,m,np,alpha,A,B,w,dico,tol=0.0,ldwork=None):
Raises
------
SlycotParameterError
:info = -i: the i-th argument had an illegal value;
SlycotArithmeticError
:info = 1:
the reduction of A to a real Schur form failed;
Expand Down Expand Up @@ -128,7 +131,6 @@ def sb01bd(n,m,np,alpha,A,B,w,dico,tol=0.0,ldwork=None):
Example
-------
>>> import numpy as np
>>> import slycot
>>> A = np.array([[0, 1, 0], [0, 0, 1], [-2, 1, 3]])
Expand Down Expand Up @@ -304,7 +306,6 @@ def sb02md(n,A,G,Q,dico,hinv='D',uplo='U',scal='N',sort='S',ldwork=None):
Example
-------
>>> import numpy as np
>>> import slycot
>>> A = np.array([[0, 1], [0, 0]])
Expand Down Expand Up @@ -440,6 +441,8 @@ def sb02mt(n,m,B,R,A=None,Q=None,L=None,fact='N',jobl='Z',uplo='U',ldwork=None):
Raises
------
SlycotParameterError
:info = -i: the i-th argument had an illegal value;
SlycotArithmeticError
:1 <= info <= m:
The {info}-th element of the `d` factor is
Expand Down Expand Up @@ -599,6 +602,8 @@ def sb02od(n,m,A,B,Q,R,dico,p=None,L=None,fact='N',uplo='U',sort='S',tol=0.0,ldw
Raises
------
SlycotParameterError
:info = -i: the i-th argument had an illegal value;
SlycotArithmeticError
:info = 1:
The computed extended matrix pencil is singular,
Expand All @@ -622,7 +627,6 @@ def sb02od(n,m,A,B,Q,R,dico,p=None,L=None,fact='N',uplo='U',sort='S',tol=0.0,ldw
Example
-------
>>> import numpy as np
>>> import slycot
>>> A = np.array([[0, 1], [0, 0]])
Expand Down Expand Up @@ -760,6 +764,11 @@ def sb03md57(A, U=None, C=None,
w : (n, ) complex ndarray
If fact = 'N', this array contains the eigenvalues of A.
Raises
------
SlycotParameterError
:info = -i: the i-th argument had an illegal value;
Warns
-----
SlycotResultWarning
Expand Down Expand Up @@ -918,6 +927,8 @@ def sb03od(n,m,A,Q,B,dico,fact='N',trans='N',ldwork=None):
Raises
------
SlycotParameterError
:info = -i: the i-th argument had an illegal value;
SlycotArithmeticError
:info = 4:
FACT = 'F' and the Schur factor S supplied in
Expand Down Expand Up @@ -1027,6 +1038,8 @@ def sb04md(n,m,A,B,C,ldwork=None):
Raises
------
SlycotParameterError
:info = -i: the i-th argument had an illegal value;
SlycotArithmeticError
:0 < info <= m:
The QR algorithm failed to compute all the eigenvalues
Expand Down Expand Up @@ -1076,6 +1089,8 @@ def sb04qd(n,m,A,B,C,ldwork=None):
Raises
------
SlycotParameterError
:info = -i: the i-th argument had an illegal value;
SlycotArithmeticError
:0 < info <= m:
The QR algorithm failed to compute all the eigenvalues
Expand Down Expand Up @@ -1222,6 +1237,8 @@ def sb10ad(n,m,np,ncon,nmeas,gamma,A,B,C,D,job=3,gtol=0.0,actol=0.0,liwork=None,
Raises
------
SlycotParameterError
:info = -i: the i-th argument had an illegal value;
SlycotArithmeticError
:info = 1:
The matrix
Expand Down Expand Up @@ -1431,6 +1448,8 @@ def sb10dd(n,m,np,ncon,nmeas,gamma,A,B,C,D,tol=0.0,ldwork=None):
Raises
------
SlycotParameterError
:info = -i: the i-th argument had an illegal value;
SlycotArithmeticError
:info = 1:
The matrix
Expand Down Expand Up @@ -1587,6 +1606,8 @@ def sb10hd(n,m,np,ncon,nmeas,A,B,C,D,tol=0.0,ldwork=None):
Raises
------
SlycotParameterError
:info = -i: the i-th argument had an illegal value;
SlycotArithmeticError
:info = 1:
The matrix D12 had not full column rank in
Expand Down Expand Up @@ -1681,6 +1702,8 @@ def sb10jd(n,m,np,A,B,C,D,E,ldwork=None):
Raises
------
SlycotParameterError
:info = -i: the i-th argument had an illegal value;
SlycotArithmeticError
:info == 1:
The iteration for computing singular value
Expand Down Expand Up @@ -1766,6 +1789,8 @@ def sb10yd(discfl,flag,lendat,rfrdat,ifrdat,omega,n,tol,ldwork=None):
Raises
------
SlycotParameterError
:info = -i: the i-th argument had an illegal value;
SlycotArithmeticError
:info == 0: successful exit;
:info < 0: if info = -i, the i-th argument had an illegal value
Expand Down Expand Up @@ -1984,6 +2009,8 @@ def sg03ad(dico,job,fact,trans,uplo,N,A,E,Q,Z,X,ldwork=None):
Raises
------
SlycotParameterError
:info = -i: the i-th argument had an illegal value;
SlycotArithmeticError
:info = 1:
FACT = 'F' and the matrix contained in the upper
Expand Down Expand Up @@ -2206,6 +2233,7 @@ def sg02ad(dico,jobb,fact,uplo,jobl,scal,sort,acc,N,M,P,A,E,B,Q,R,L,ldwork=None,
LDR >= MAX(1,M) if JOBB = 'B' and FACT = 'N' or 'C';
LDR >= MAX(1,P) if JOBB = 'B' and FACT = 'D' or 'B';
LDR >= 1 if JOBB = 'G'.
L : (n, M) array_like
If JOBL = 'N' and JOBB = 'B', the leading N-by-M part of
this array must contain the cross weighting matrix L.
Expand All @@ -2217,6 +2245,7 @@ def sg02ad(dico,jobb,fact,uplo,jobl,scal,sort,acc,N,M,P,A,E,B,Q,R,L,ldwork=None,
LDWORK >= MAX(7*(2*N+1)+16,16*N), if JOBB = 'G';
LDWORK >= MAX(7*(2*N+1)+16,16*N,2*N+M,3*M), if JOBB = 'B'.
For optimum performance LDWORK should be larger.
Default: ``max(7*(2*n+1)+16,16*n)``
tol : float, optional
Expand Down Expand Up @@ -2316,6 +2345,8 @@ def sg02ad(dico,jobb,fact,uplo,jobl,scal,sort,acc,N,M,P,A,E,B,Q,R,L,ldwork=None,
Raises
------
SlycotParameterError
:info = -i: the i-th argument had an illegal value;
SlycotArithmeticError
:info = 1:
The computed extended matrix pencil is singular,
Expand Down Expand Up @@ -2495,11 +2526,13 @@ def sg03bd(n,m,A,E,Q,Z,B,dico,fact='N',trans='N',ldwork=None):
on entry or not:
:= 'N': Factorization is not supplied;
:= 'F': Factorization is supplied.
Default is 'N'.
trans : {'N', 'T'}, optional
Specifies whether the transposed equation is to be solved
or not:
:= 'N': op(A) = A, op(E) = E;
:= 'T': op(A) = A**T, op(E) = E**T.
Default is 'N'.
ldwork : int, optional
The dimension of the array dwork::
Expand All @@ -2521,9 +2554,12 @@ def sg03bd(n,m,A,E,Q,Z,B,dico,fact='N',trans='N',ldwork=None):
If INFO = 0, 3, 5, 6, or 7, then
((j), j=1,...,n, are the
eigenvalues of the matrix pencil A - lambda * E.
Default is None.
Raises
------
SlycotParameterError
:info = -i: the i-th argument had an illegal value;
SlycotArithmeticError
:info = 2:
fact = 'F' and the matrix contained in the upper
Expand Down Expand Up @@ -2647,7 +2683,7 @@ def sb10fd(n,m,np,ncon,nmeas,gamma,A,B,C,D,tol=0.0,ldwork=None):
whose reciprocal condition numbers are less than tol are
not allowed. If tol <= 0, then a default value equal to
sqrt(eps) is used, where eps is the relative machine
precision.
precision. Default is `0.0`.
ldwork : int, optional
The dimension of the cache array::
Expand Down Expand Up @@ -2683,7 +2719,7 @@ def sb10fd(n,m,np,ncon,nmeas,gamma,A,B,C,D,tol=0.0,ldwork=None):
if the default (None) value is used, the size for good performance
is automatically used, when ldwork is set to zero, the minimum
cache size will be used.
cache size will be used. Default is None.
Returns
-------
Expand Down Expand Up @@ -2712,6 +2748,7 @@ def sb10fd(n,m,np,ncon,nmeas,gamma,A,B,C,D,tol=0.0,ldwork=None):
Raises
------
SlycotParameterError
:info = -i: the i-th argument had an illegal value;
:info = -27:
The dimension ldwork of the cache array is too small.
Use ldwork=0 for the minimum size or ldwork=None for automatic
Expand Down

0 comments on commit 370f816

Please sign in to comment.