Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add docstring, Change parameter name from type_bn to type_t
  • Loading branch information
KybernetikJo committed Aug 23, 2023
commit 416b352ec96fe5b6221fe6c4c99d2a78479424a4
66 changes: 61 additions & 5 deletions slycot/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,75 @@ def ab01nd(n, m, A, B, jobz='N', tol=0, ldwork=None):
Z = None
return Ac, Bc, ncont, indcon, nblk, Z, tau

def ab04md(type_bn, n, m, p, A, B, C, D, alpha=1.0, beta=1.0, ldwork=None):
""" a,b,c,d = ab04md()
def ab04md(type_t, n, m, p, A, B, C, D, alpha=1.0, beta=1.0, ldwork=None):
""" At,Bt,Ct,Dt = ab04md(type_bn, n, m, p, A, B, C, D, [alpha, beta,ldwork])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
""" At,Bt,Ct,Dt = ab04md(type_bn, n, m, p, A, B, C, D, [alpha, beta,ldwork])
""" At,Bt,Ct,Dt = ab04md(type_t, n, m, p, A, B, C, D, [alpha, beta, ldwork])


Parameters
----------
type_t : {'D','C'}
Indicates the type of the original system and the
transformation to be performed as follows:
= 'D': discrete-time -> continuous-time;
= 'C': continuous-time -> discrete-time.
n : input int
Comment thread
KybernetikJo marked this conversation as resolved.
Outdated
The order of the matrix A, the number of rows of matrix B and
the number of columns of matrix C. It represents the dimension of
the state vector. n > 0.
m : input int
The number of columns of matrix B. It represents the dimension of
the input vector. m > 0.
p : input int
The number of rows of matrix C. It represents the dimension of
the output vector. p > 0.
A : input rank-2 array('d') with bounds (n,n)
The leading n-by-n part of this array must contain the system state
matrix A.
B : input rank-2 array('d') with bounds (n,m)
The leading n-by-m part of this array must contain the system input
matrix B.
C : input rank-2 array('d') with bounds (p,n)
The leading p-by-n part of this array must contain the system output
matrix C.
D : input rank-2 array('d') with bounds (p,m)
The leading p-by-m part of this array must contain the system direct
transmission matrix D.
alpha : double

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
alpha : double
alpha : double, optional

Parameter specifying the bilinear transformation.
Recommended values for stable systems: alpha = 1, alpha != 0,
beta : double
Parameter specifying the bilinear transformation.
Recommended values for stable systems: beta = 1, beta != 0,
ldwork : int
The length of the cache array.
ldwork >= max(1, n)
Returns
-------
At : output rank-2 array('d') with bounds (n,n)
The state matrix At of the transformed system.
Bt : output rank-2 array('d') with bounds (n,m)
The input matrix Bt of the transformed system.
Ct : output rank-2 array('d') with bounds (p,n)
The output matrix Ct of the transformed system.
Dt : output rank-2 array('d') with bounds (p,m)
The transmission matrix Dt of the transformed system.
Raises
------
SlycotArithmeticError
:info == 1:
If the matrix (ALPHA*I + A) is exactly singular
:info == 2:
If the matrix (BETA*I - A) is exactly singular.
"""

hidden = ' (hidden by the wrapper)'
arg_list = ['type_bn', 'n', 'm', 'p', 'alpha', 'beta',
arg_list = ['type_t', 'n', 'm', 'p', 'alpha', 'beta',
'A', 'LDA'+hidden, 'B', 'LDB'+hidden, 'C', 'LDC'+hidden, 'D', 'LDD'+hidden,
'IWORK'+hidden, 'DWORK'+hidden, 'ldwork', 'info'+hidden]

if ldwork is None:
ldwork = max(n, 3*m)
ldwork = max(1, n)

out = _wrapper.ab04md(type_bn, n, m, p, alpha, beta, A, B, C, D, ldwork=ldwork)
out = _wrapper.ab04md(type_t, n, m, p, alpha, beta, A, B, C, D, ldwork=ldwork)
info=out[-1]
raise_if_slycot_error(info, arg_list)

Expand Down
4 changes: 2 additions & 2 deletions slycot/src/analysis.pyf
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ subroutine ab01nd(jobz,n,m,a,lda,b,ldb,ncont,indcon,nblk,z,ldz,tau,tol,iwork,dwo
integer :: ldwork = max(n,3*m)
integer intent(out) :: info
end subroutine ab01nd
subroutine ab04md(type_bn,n,m,p,alpha,beta,a,lda,b,ldb,c,ldc,d,ldd,iwork,dwork,ldwork,info) ! in AB04MD.f
character :: type_bn
subroutine ab04md(type_t,n,m,p,alpha,beta,a,lda,b,ldb,c,ldc,d,ldd,iwork,dwork,ldwork,info) ! in AB04MD.f
character :: type_t
integer check(n>=0) :: n
integer check(m>=0) :: m
integer check(p>=0) :: p
Expand Down