@@ -305,7 +305,6 @@ def check_LQR(self, K, S, poles, Q, R):
305
305
np .testing .assert_array_almost_equal (K , K_expected )
306
306
np .testing .assert_array_almost_equal (poles , poles_expected )
307
307
308
-
309
308
@pytest .mark .parametrize ("method" , [None , 'slycot' , 'scipy' ])
310
309
def test_LQR_integrator (self , matarrayin , matarrayout , method ):
311
310
if method == 'slycot' and not slycot_check ():
@@ -334,7 +333,6 @@ def test_lqr_slycot_not_installed(self):
334
333
with pytest .raises (ControlSlycot , match = "can't find slycot" ):
335
334
K , S , poles = lqr (A , B , Q , R , method = 'slycot' )
336
335
337
- @slycotonly
338
336
@pytest .mark .xfail (reason = "warning not implemented" )
339
337
def testLQR_warning (self ):
340
338
"""Test lqr()
@@ -395,13 +393,11 @@ def check_LQE(self, L, P, poles, G, QN, RN):
395
393
np .testing .assert_array_almost_equal (L , L_expected )
396
394
np .testing .assert_array_almost_equal (poles , poles_expected )
397
395
398
- @slycotonly
399
396
def test_LQE (self , matarrayin ):
400
397
A , G , C , QN , RN = (matarrayin ([[X ]]) for X in [0. , .1 , 1. , 10. , 2. ])
401
398
L , P , poles = lqe (A , G , C , QN , RN )
402
399
self .check_LQE (L , P , poles , G , QN , RN )
403
400
404
- @slycotonly
405
401
def test_lqe_call_format (self ):
406
402
# Create a random state space system for testing
407
403
sys = rss (4 , 3 , 2 )
@@ -438,7 +434,6 @@ def test_lqe_call_format(self):
438
434
with pytest .raises (ct .ControlDimension , match = "incorrect covariance" ):
439
435
L , P , E = lqe (sys .A , sys .B , sys .C , R , Q )
440
436
441
- @slycotonly
442
437
def test_care (self , matarrayin ):
443
438
"""Test stabilizing and anti-stabilizing feedbacks, continuous"""
444
439
A = matarrayin (np .diag ([1 , - 1 ]))
@@ -447,12 +442,17 @@ def test_care(self, matarrayin):
447
442
R = matarrayin (np .identity (2 ))
448
443
S = matarrayin (np .zeros ((2 , 2 )))
449
444
E = matarrayin (np .identity (2 ))
445
+
450
446
X , L , G = care (A , B , Q , R , S , E , stabilizing = True )
451
447
assert np .all (np .real (L ) < 0 )
452
- X , L , G = care (A , B , Q , R , S , E , stabilizing = False )
453
- assert np .all (np .real (L ) > 0 )
454
448
455
- @slycotonly
449
+ if slycot_check ():
450
+ X , L , G = care (A , B , Q , R , S , E , stabilizing = False )
451
+ assert np .all (np .real (L ) > 0 )
452
+ else :
453
+ with pytest .raises (ValueError , match = "'scipy' not valid" ):
454
+ X , L , G = care (A , B , Q , R , S , E , stabilizing = False )
455
+
456
456
def test_dare (self , matarrayin ):
457
457
"""Test stabilizing and anti-stabilizing feedbacks, discrete"""
458
458
A = matarrayin (np .diag ([0.5 , 2 ]))
@@ -461,7 +461,13 @@ def test_dare(self, matarrayin):
461
461
R = matarrayin (np .identity (2 ))
462
462
S = matarrayin (np .zeros ((2 , 2 )))
463
463
E = matarrayin (np .identity (2 ))
464
+
464
465
X , L , G = dare (A , B , Q , R , S , E , stabilizing = True )
465
466
assert np .all (np .abs (L ) < 1 )
466
- X , L , G = dare (A , B , Q , R , S , E , stabilizing = False )
467
- assert np .all (np .abs (L ) > 1 )
467
+
468
+ if slycot_check ():
469
+ X , L , G = care (A , B , Q , R , S , E , stabilizing = False )
470
+ assert np .all (np .real (L ) > 0 )
471
+ else :
472
+ with pytest .raises (ValueError , match = "'scipy' not valid" ):
473
+ X , L , G = care (A , B , Q , R , S , E , stabilizing = False )
0 commit comments