1- # ===================================================
2- # ab08n* tests
3-
4- import unittest
51from slycot import analysis
62import numpy as np
73
8- from scipy .linalg import eig
9- from numpy .testing import assert_equal , assert_allclose
4+ from numpy .testing import assert_allclose
105
116
12- class test_ab04md ( unittest . TestCase ) :
7+ class test_ab04md :
138 """Test ab04md.
14-
9+
1510 Example data taken from
16- https://www.slicot.org/objects/software/shared/doc/AB04MD.html.
11+ https://www.slicot.org/objects/software/shared/doc/AB04MD.html
1712 """
1813
1914 Ac = np .array ([[1.0 , 0.5 ],
20- [0.5 , 1.0 ]])
15+ [0.5 , 1.0 ]])
2116 Bc = np .array ([[0.0 , - 1.0 ],
22- [1.0 , 0.0 ]])
17+ [1.0 , 0.0 ]])
2318 Cc = np .array ([[- 1.0 , 0.0 ],
24- [0.0 , 1.0 ]])
19+ [0.0 , 1.0 ]])
2520 Dc = np .array ([[1.0 , 0.0 ],
26- [0.0 , - 1.0 ]])
21+ [0.0 , - 1.0 ]])
2722
2823 Ad = np .array ([[- 1.0 , - 4.0 ],
29- [- 4.0 , - 1.0 ]])
24+ [- 4.0 , - 1.0 ]])
3025 Bd = np .array ([[2.8284 , 0.0 ],
31- [0.0 , - 2.8284 ]])
26+ [0.0 , - 2.8284 ]])
3227 Cd = np .array ([[0.0 , 2.8284 ],
33- [- 2.8284 , 0.0 ]])
28+ [- 2.8284 , 0.0 ]])
3429 Dd = np .array ([[- 1.0 , 0.0 ],
35- [0.0 , - 3.0 ]])
30+ [0.0 , - 3.0 ]])
3631
3732 def test_ab04md_cont_disc_cont (self ):
3833 """Test transformation from continuous - to discrete - to continuous time.
@@ -41,31 +36,31 @@ def test_ab04md_cont_disc_cont(self):
4136 n , m = self .Bc .shape
4237 p = self .Cc .shape [0 ]
4338
44- Ad_t , Bd_t , Cd_t , Dd_t = analysis .ab04md ('C' ,n ,m ,p ,self .Ac ,self .Bc ,self .Cc ,self .Dc )
39+ Ad_t , Bd_t , Cd_t , Dd_t = analysis .ab04md (
40+ 'C' , n , m , p , self .Ac , self .Bc , self .Cc , self .Dc )
4541
46- Ac_t , Bc_t , Cc_t , Dc_t = analysis .ab04md ('D' ,n ,m ,p ,Ad_t ,Bd_t ,Cd_t ,Dd_t )
42+ Ac_t , Bc_t , Cc_t , Dc_t = analysis .ab04md (
43+ 'D' , n , m , p , Ad_t , Bd_t , Cd_t , Dd_t )
4744
4845 assert_allclose (self .Ac , Ac_t )
4946 assert_allclose (self .Bc , Bc_t )
5047 assert_allclose (self .Cc , Cc_t )
5148 assert_allclose (self .Dc , Dc_t )
52-
49+
5350 def test_ab04md_disc_cont_disc (self ):
5451 """Test transformation from discrete - to continuous - to discrete time.
5552 """
5653
5754 n , m = self .Bc .shape
5855 p = self .Cc .shape [0 ]
5956
60- Ac_t , Bc_t , Cc_t , Dc_t = analysis .ab04md ('D' ,n ,m ,p ,self .Ad ,self .Bd ,self .Cd ,self .Dd )
57+ Ac_t , Bc_t , Cc_t , Dc_t = analysis .ab04md (
58+ 'D' , n , m , p , self .Ad , self .Bd , self .Cd , self .Dd )
6159
62- Ad_t , Bd_t , Cd_t , Dd_t = analysis .ab04md ('C' ,n ,m ,p ,Ac_t ,Bc_t ,Cc_t ,Dc_t )
60+ Ad_t , Bd_t , Cd_t , Dd_t = analysis .ab04md (
61+ 'C' , n , m , p , Ac_t , Bc_t , Cc_t , Dc_t )
6362
6463 assert_allclose (self .Ad , Ad_t )
6564 assert_allclose (self .Bd , Bd_t )
6665 assert_allclose (self .Cd , Cd_t )
6766 assert_allclose (self .Dd , Dd_t )
68-
69-
70- if __name__ == "__main__" :
71- unittest .main ()
0 commit comments