Skip to content

Commit 196e4ec

Browse files
Benjamin Greinerroryyorke
Benjamin Greiner
authored andcommitted
whitespace fixes
1 parent 2cf6902 commit 196e4ec

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

slycot/tests/test_td04ad.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class TestTf2SS(unittest.TestCase):
1414

1515
def test_td04ad_c(self):
1616
"""td04ad: Convert with 'C' option"""
17-
17+
1818
# for octave:
1919
"""
2020
num = { [0.0, 0.0, 1.0 ], [ 1.0, 0.0 ];
@@ -24,36 +24,36 @@ def test_td04ad_c(self):
2424
[1.0, 0.4, 3.0], [ 1.0, 1.0 ];
2525
[1.0, 0.4, 3.0], [ 1.0, 1.0 ]};
2626
"""
27-
27+
2828
m = 2
2929
p = 3
30-
d = 3
30+
d = 3
3131
num = np.array([
3232
[ [0.0, 0.0, 1.0], [1.0, 0.0, 0.0] ],
3333
[ [3.0, -1.0, 1.0], [0.0, 1.0, 0.0] ],
3434
[ [0.0, 0.0, 1.0], [0.0, 2.0, 0.0] ] ])
35-
35+
3636
numc = np.zeros((max(1, m, p), max(1, m, p), d), dtype=float)
3737
numc[:p,:m,:] = num
3838
denc = np.array(
3939
[ [1.0, 0.4, 3.0], [ 1.0, 1.0, 0.0 ] ])
4040
indc = np.array(
4141
[ 2, 1 ], dtype=int)
42-
42+
4343
nref = 3
4444
Aref = np.array([ [-1, 0, 0],
4545
[ 0, -0.4, -0.3],
4646
[ 0, 10, 0] ])
4747
Bref = np.array([ [0, -1],
48-
[1, 0],
48+
[1, 0],
4949
[0, 0] ])
5050
Cref = np.array([ [1, 0, 0.1],
5151
[-1, -2.2, -0.8],
5252
[-2, 0, 0.1] ])
5353
Dref = np.array([ [0, 1],
5454
[3, 0],
5555
[0, 0] ])
56-
56+
5757
nr, A, B, C, D = transform.td04ad('C', m, p, indc, denc, numc)
5858
#print('A=\n', A, '\nB=\n', B, '\nC=\n', C, '\nD=\n', D)
5959
np.testing.assert_equal(nref, nr)
@@ -70,78 +70,78 @@ def test_td04ad_c(self):
7070

7171
def test_td04ad_r(self):
7272
"""td04ad: Convert with 'R' option"""
73-
73+
7474
""" example program from
7575
http://slicot.org/objects/software/shared/doc/TD04AD.html"""
76-
76+
7777
m = 2
7878
p = 2
7979
rowcol = 'R'
8080
index = [3, 3]
8181
dcoeff = np.array([ [1.0, 6.0, 11.0, 6.0], [1.0, 6.0, 11.0, 6.0] ])
82-
82+
8383
ucoeff = np.array([ [[1.0, 6.0, 12.0, 7.0], [0.0, 1.0, 4.0, 3.0]],
84-
[[0.0, 0.0, 1.0, 1.0], [1.0, 8.0, 20.0, 15.0]] ])
85-
84+
[[0.0, 0.0, 1.0, 1.0], [1.0, 8.0, 20.0, 15.0]] ])
85+
8686
nref = 3
8787

8888
Aref = np.array([ [ 0.5000, -0.8028, 0.9387],
8989
[ 4.4047, -2.3380, 2.5076],
9090
[-5.5541, 1.6872, -4.1620] ])
9191
Bref = np.array([ [-0.2000, -1.2500],
9292
[ 0.0000, -0.6097],
93-
[ 0.0000, 2.2217] ])
93+
[ 0.0000, 2.2217] ])
9494
Cref = np.array([ [0.0000, -0.8679, 0.2119],
9595
[0.0000, 0.0000, 0.9002] ])
9696
Dref = np.array([ [1.0000, 0.0000],
9797
[0.0000, 1.0000] ])
98-
98+
9999
nr, A, B, C, D = transform.td04ad(rowcol, m, p, index, dcoeff, ucoeff)
100100
#print('A=\n', A, '\nB=\n', B, '\nC=\n', C, '\nD=\n', D)
101101
np.testing.assert_equal(nref, nr)
102102
# order of states is not guaranteed, so we reorder the reference
103103
rindex = np.flip(np.argsort(np.diag(A)))
104104
Arref = Aref[rindex, :][:, rindex]
105-
Brref = Bref[rindex, :]
106-
Crref = Cref[:, rindex]
105+
Brref = Bref[rindex, :]
106+
Crref = Cref[:, rindex]
107107
Drref = Dref
108108
np.testing.assert_array_almost_equal(A, Arref,decimal=4)
109109
np.testing.assert_array_almost_equal(B, Brref,decimal=4)
110110
np.testing.assert_array_almost_equal(C, Crref,decimal=4)
111-
np.testing.assert_array_almost_equal(D, Drref,decimal=4)
111+
np.testing.assert_array_almost_equal(D, Drref,decimal=4)
112112

113113

114114
def test_staticgain(self):
115115
"""td04ad: Convert a transferfunction to SS with only static gain"""
116-
116+
117117
# 2 inputs, 3 outputs? columns share a denominator
118118
num = np.array([ [ [1.0], [2.0] ],
119119
[ [0.2], [4.3] ],
120120
[ [1.2], [3.2] ] ])
121121
p, m, d = num.shape
122122
numc = np.zeros((max(1, m, p), max(1, m, p), d), dtype=float)
123123
numc[:p,:m,:] = num
124-
124+
125125
# denc, columns share a common denominator
126126
denc = np.array([ [ 1.0], [0.5] ])
127127
Dc = (num / denc).reshape((3,2))
128128
idxc = np.zeros((2,), dtype=int)
129-
129+
130130
# denr, rows share a common denominator
131131
denr = np.array([ [1.0], [0.5], [3.0] ])
132132
idxr = np.zeros((3,), dtype=int)
133133
Dr = (num / denr[:, np.newaxis]).reshape((3,2))
134134

135135
# fails with:
136136
# On entry to TB01XD parameter number 5 had an illegal value
137-
137+
138138
n, A, B, C, D = transform.td04ad('C', 2, 3, idxc, denc, numc)
139139
#print('A=\n', A, '\nB=\n', B, '\nC=\n', C, '\nD=\n', D)
140140
self.assertEqual(A.shape, (0,0))
141141
self.assertEqual(B.shape, (0,2))
142142
self.assertEqual(C.shape, (3,0))
143143
np.testing.assert_array_almost_equal(D, Dc)
144-
144+
145145
n, A, B, C, D = transform.td04ad('R', 2, 3, idxr, denr, num)
146146
#print('A=\n', A, '\nB=\n', B, '\nC=\n', C, '\nD=\n', D)
147147
self.assertEqual(A.shape, (0,0))
@@ -187,7 +187,7 @@ def test_mixfeedthrough(self):
187187
idxc = np.array([ 1, 0 ])
188188
n, A, B, C, D = transform.td04ad('C', 2, 2, idxc, denc, numc)
189189
np.testing.assert_array_almost_equal(D, np.array([[0, 0],[-0.1, 0]]))
190-
190+
191191
def test_toandfrom(self):
192192

193193
A = np.array([[-3.0]])
@@ -205,7 +205,7 @@ def test_toandfrom(self):
205205
np.testing.assert_array_almost_equal(A, At)
206206

207207
def test_tfm2ss_6(self):
208-
"""Python version of Fortran test program from
208+
"""Python version of Fortran test program from
209209
-- Bug in TD04AD when ROWCOL='C' #6
210210
This bug was fixed in PR #27"""
211211
m = 1
@@ -219,6 +219,6 @@ def test_tfm2ss_6(self):
219219
n, A, B, C, D = transform.td04ad('C', m, p, index, dcoeff, ucoeff)
220220
self.assertEqual(n, 0)
221221
np.testing.assert_array_almost_equal(D, np.array([[64]]))
222-
222+
223223
if __name__ == "__main__":
224224
unittest.main()

0 commit comments

Comments
 (0)