Skip to content

Commit

Permalink
Add new api for ab13bd, pytest was successful
Browse files Browse the repository at this point in the history
  • Loading branch information
KybernetikJo committed Jul 27, 2023
1 parent 294eae0 commit fac5467
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 18 deletions.
6 changes: 3 additions & 3 deletions slycot/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1378,15 +1378,15 @@ def ab13bd(dico, jobn, n, m, p, A, B, C, D, tol = 0.0):
denominator of `G` (see the SLICOT subroutine SB08DD).
"""

out = _wrapper.ab13bd(dico, jobn, n, m, p, A, B, C, D, tol)
out = _wrapper.ab13bd(A, B, C, D, dico=dico, jobn=jobn, n=n, m=m, p=p, tol=tol)

hidden = ' (hidden by the wrapper)'
arg_list = ('dico', 'jobn', 'n', 'm', 'p',
'A', 'lda' + hidden, 'B', 'ldb' + hidden, 'C', 'ldc' + hidden,
'D', 'ldd' + hidden, 'nq' + hidden,'tol', 'dwork' + hidden,
'ldwork' + hidden, 'iwarn', 'info')
raise_if_slycot_error(out[-2:], arg_list, ab13bd.__doc__, locals())
return out[0]
#raise_if_slycot_error(out[-1], arg_list, ab13bd.__doc__, locals())
return out[:-1]

def ab13dd(dico, jobe, equil, jobd, n, m, p, A, E, B, C, D, tol = 1e-10):
"""gpeak, fpeak = ab13dd(dico, jobe, equil, jobd, n, m, p, A, E, B, C, D, [tol])
Expand Down
30 changes: 15 additions & 15 deletions slycot/src/analysis.pyf
Original file line number Diff line number Diff line change
Expand Up @@ -302,23 +302,23 @@ subroutine ab09nd(dico,job,equil,ordsel,n,m,p,nr,alpha,a,lda,b,ldb,c,ldc,d,ldd,n
integer intent(out) :: info
end subroutine ab09nd
function ab13bd(dico,jobn,n,m,p,a,lda,b,ldb,c,ldc,d,ldd,nq,tol,dwork,ldwork,iwarn,info) ! in AB13BD.f
character intent(in) :: dico
character intent(in) :: jobn
integer check(n>=0) :: n
integer check(n>=0) :: m
integer check(n>=0) :: p
double precision dimension(n,n),depend(n) :: a
integer intent(hide),depend(a) :: lda = shape(a,0)
double precision dimension(n,m),depend(n,m) :: b
integer intent(hide),depend(b) :: ldb = shape(b,0)
double precision dimension(p,n),depend(n,p) :: c
integer intent(hide),depend(c) :: ldc = shape(c,0)
double precision dimension(p,m),depend(m,p) :: d
integer intent(hide),depend(d) :: ldd = shape(d,0)
character optional :: dico = 'C'
character optional :: jobn = 'H'
integer optional :: n = shape(a,0)
integer optional :: m = shape(b,1)
integer optional :: p = shape(c,0)
double precision dimension(n,n), intent(in,out,copy) :: a
integer optional, depend(a) :: lda = shape(a,0)
double precision dimension(n,m), intent(in,out,copy) :: b
integer optional, depend(b) :: ldb = shape(b,0)
double precision dimension(p,n), intent(in,out,copy) :: c
integer optional, depend(c) :: ldc = shape(c,0)
double precision dimension(p,m), intent(in,out,copy) :: d
integer optional, depend(d) :: ldd = shape(d,0)
integer intent(out) :: nq
double precision :: tol
double precision optional :: tol = 0.0
double precision intent(hide,cache),dimension(ldwork),depend(ldwork) :: dwork
integer intent(hide),depend(n,m,p) :: ldwork = max(1,max(m*(n+m)+max(n*(n+5),max(m*(m+2),4*p)),n*(max(n,p)+4)+min(n,p)))
integer optional :: ldwork = max(1,max(m*(n+m)+max(n*(n+5),max(m*(m+2),4*p)),n*(max(n,p)+4)+min(n,p)))
integer intent(out) :: iwarn
integer intent(out) :: info
double precision intent(out) :: ab13bd
Expand Down
1 change: 1 addition & 0 deletions slycot/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ set(PYSOURCE
__init__.py
test_ab01.py
test_ab08n.py
test_ab13bd.py
test_ag08bd.py
test_examples.py
test_exceptions.py
Expand Down
19 changes: 19 additions & 0 deletions slycot/tests/test_ab13bd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# ===================================================
# ag08bd tests

import unittest
from slycot import analysis
import numpy as np

class test_ab13bd(unittest.TestCase):
"""Verify ab13bd new api"""

A1 = np.array([[0.0, 1.0],[-0.5, -0.1]])
B1 = np.array([[0.],[1.]])
C1 = np.eye(2)
D1 = np.zeros((2,1))

def test1_ab13bd_new_api(self):
"""test
"""
h2norm, *_ = analysis._wrapper.ab13bd(self.A1,self.B1,self.C1,self.D1)

0 comments on commit fac5467

Please sign in to comment.