8000 Fix: a and c matrices must have at least one column in td04ad_r by roryyorke · Pull Request #5 · python-control/Slycot · GitHub
[go: up one dir, main page]

Skip to content

Fix: a and c matrices must have at least one column in td04ad_r #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 5 additions & 2 deletions slycot/src/transform.pyf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
! -*- f90 -*-
! Note: the context of this file is case sensitive.

subroutine tb01id(job,n,m,p,maxred,a,lda,b,ldb,c,ldc,scale,info) ! in TB01ID.f
character intent(in) :: job = 'A'
integer required,check(n>0) :: n
Expand Down Expand Up @@ -227,11 +230,11 @@ subroutine td04ad_r(rowcol,m,p,index_bn,dcoeff,lddcoe,ucoeff,lduco1,lduco2,nr,a,
integer intent(hide),depend(ucoeff) :: lduco1=shape(ucoeff,0)
integer intent(hide),depend(ucoeff) :: lduco2=shape(ucoeff,1)
integer intent(in,out) :: nr !=sum(index_bn)
double precision intent(out),dimension(max(1,nr),nr),depend(nr) :: a
double precision intent(out),dimension(max(1,nr),max(1,nr)),depend(nr) :: a
integer intent(hide),depend(a) :: lda = shape(a,0)
double precision intent(out),dimension(max(1,nr),max(m,p)),depend(nr,m,p) :: b
integer intent(hide),depend(b) :: ldb = shape(b,0)
double precision intent(out),dimension(max(1,max(m,p)),nr),depend(nr,m,p) :: c
double precision intent(out),dimension(max(1,max(m,p)),max(1,nr)),depend(nr,m,p) :: c
integer intent(hide),depend(c) :: ldc = shape(c,0)
double precision intent(out),dimension(max(1,p),m),depend(p,m) :: d
integer intent(hide),depend(d) :: ldd = shape(d,0)
Expand Down
28 changes: 25 additions & 3 deletions slycot/tests/test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
from .. import synthesis
from .. import math

from slycot import synthesis
from slycot import math
from slycot import transform

class Test(unittest.TestCase):

Expand Down Expand Up @@ -48,3 +48,25 @@ def test_sb02ad(self):
self.assertAlmostEqual(Ac[0][1], -1)
self.assertAlmostEqual(Ac[1][0], 1)
self.assertAlmostEqual(Ac[1][1], -3)

def test_td04ad_static(self):
"""Regression: td04ad (TFM -> SS transformation) for static TFM"""
import numpy as np
from itertools import product
# 'C' fails on static TFs
for nout,nin,rc in product(range(1,6),range(1,6),['R']):
num = np.reshape(np.arange(nout*nin),(nout,nin,1))
if rc == 'R':
den = np.reshape(np.arange(1,1+nout),(nout,1))
else:
den = np.reshape(np.arange(1,1+nin),(nin,1))
index = np.tile([0],den.shape[0])
nr,a,b,c,d = transform.td04ad(rc,nin,nout,index,den,num)


def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestConvert)


if __name__ == "__main__":
unittest.main()
0