@@ -88,10 +88,10 @@ def lyap(A,Q,C=None,E=None):
88
88
if len (shape (Q )) == 1 :
89
89
Q = Q .reshape (1 ,Q .size )
90
90
91
- if C != None and len (shape (C )) == 1 :
91
+ if C is not None and len (shape (C )) == 1 :
92
92
C = C .reshape (1 ,C .size )
93
93
94
- if E != None and len (shape (E )) == 1 :
94
+ if E is not None and len (shape (E )) == 1 :
95
95
E = E .reshape (1 ,E .size )
96
96
97
97
# Determine main dimensions
@@ -106,7 +106,7 @@ def lyap(A,Q,C=None,E=None):
106
106
m = size (Q ,0 )
107
107
108
108
# Solve standard Lyapunov equation
109
- if C == None and E == None :
109
+ if C is None and E is None :
110
110
# Check input data for consistency
111
111
if shape (A ) != shape (Q ):
112
112
raise ControlArgument ("A and Q must be matrices of identical \
@@ -139,7 +139,7 @@ def lyap(A,Q,C=None,E=None):
139
139
raise e
140
140
141
141
# Solve the Sylvester equation
142
- elif C != None and E == None :
142
+ elif C is not None and E is None :
143
143
# Check input data for consistency
144
144
if size (A ) > 1 and shape (A )[0 ] != shape (A )[1 ]:
145
145
raise ControlArgument ("A must be a quadratic matrix." )
@@ -170,7 +170,7 @@ def lyap(A,Q,C=None,E=None):
170
170
raise e
171
171
172
172
# Solve the generalized Lyapunov equation
173
- elif C == None and E != None :
173
+ elif C is None and E is not None :
174
174
# Check input data for consistency
175
175
if (size (Q ) > 1 and shape (Q )[0 ] != shape (Q )[1 ]) or \
176
176
(size (Q ) > 1 and shape (Q )[0 ] != n ) or \
@@ -275,10 +275,10 @@ def dlyap(A,Q,C=None,E=None):
275
275
if len (shape (Q )) == 1 :
276
276
Q = Q .reshape (1 ,Q .size )
277
277
278
- if C != None and len (shape (C )) == 1 :
278
+ if C is not None and len (shape (C )) == 1 :
279
279
C = C .reshape (1 ,C .size )
280
280
281
- if E != None and len (shape (E )) == 1 :
281
+ if E is not None and len (shape (E )) == 1 :
282
282
E = E .reshape (1 ,E .size )
283
283
284
284
# Determine main dimensions
@@ -293,7 +293,7 @@ def dlyap(A,Q,C=None,E=None):
293
293
m = size (Q ,0 )
294
294
295
295
# Solve standard Lyapunov equation
296
- if C == None and E == None :
296
+ if C is None and E is None :
297
297
# Check input data for consistency
298
298
if shape (A ) != shape (Q ):
299
299
raise ControlArgument ("A and Q must be matrices of identical \
@@ -322,7 +322,7 @@ def dlyap(A,Q,C=None,E=None):
322
322
raise e
323
323
324
324
# Solve the Sylvester equation
325
- elif C != None and E == None :
325
+ elif C is not None and E is None :
326
326
# Check input data for consistency
327
327
if size (A ) > 1 and shape (A )[0 ] != shape (A )[1 ]:
328
328
raise ControlArgument ("A must be a quadratic matrix" )
@@ -353,7 +353,7 @@ def dlyap(A,Q,C=None,E=None):
353
353
raise e
354
354
355
355
# Solve the generalized Lyapunov equation
356
- elif C == None and E != None :
356
+ elif C is None and E is not None :
357
357
# Check input data for consistency
358
358
if (size (Q ) > 1 and shape (Q )[0 ] != shape (Q )[1 ]) or \
359
359
(size (Q ) > 1 and shape (Q )[0 ] != n ) or \
@@ -458,13 +458,13 @@ def care(A,B,Q,R=None,S=None,E=None):
458
458
if len (shape (Q )) == 1 :
459
459
Q = Q .reshape (1 ,Q .size )
460
460
461
- if R != None and len (shape (R )) == 1 :
461
+ if R is not None and len (shape (R )) == 1 :
462
462
R = R .reshape (1 ,R .size )
463
463
464
- if S != None and len (shape (S )) == 1 :
464
+ if S is not None and len (shape (S )) == 1 :
465
465
S = S .reshape (1 ,S .size )
466
466
467
- if E != None and len (shape (E )) == 1 :
467
+ if E is not None and len (shape (E )) == 1 :
468
468
E = E .reshape (1 ,E .size )
469
469
470
470
# Determine main dimensions
@@ -477,11 +477,11 @@ def care(A,B,Q,R=None,S=None,E=None):
477
477
m = 1
478
478
else :
479
479
m = size (B ,1 )
480
- if R == None :
480
+ if R is None :
481
481
R = eye (m ,m )
482
482
483
483
# Solve the standard algebraic Riccati equation
484
- if S == None and E == None :
484
+ if S is None and E is None :
485
485
# Check input data for consistency
486
486
if size (A ) > 1 and shape (A )[0 ] != shape (A )[1 ]:
487
487
raise ControlArgument ("A must be a quadratic matrix." )
@@ -562,7 +562,7 @@ def care(A,B,Q,R=None,S=None,E=None):
562
562
return (X , w [:n ] , G )
563
563
564
564
# Solve the generalized algebraic Riccati equation
565
- elif S != None and E != None :
565
+ elif S is not None and E is not None :
566
566
# Check input data for consistency
567
567
if size (A ) > 1 and shape (A )[0 ] != shape (A )[1 ]:
568
568
raise ControlArgument ("A must be a quadratic matrix." )
@@ -728,13 +728,13 @@ def dare_old(A,B,Q,R,S=None,E=None):
728
728
if len (shape (Q )) == 1 :
729
729
Q = Q .reshape (1 ,Q .size )
730
730
731
- if R != None and len (shape (R )) == 1 :
731
+ if R is not None and len (shape (R )) == 1 :
732
732
R = R .reshape (1 ,R .size )
733
733
734
- if S != None and len (shape (S )) == 1 :
734
+ if S is not None and len (shape (S )) == 1 :
735
735
S = S .reshape (1 ,S .size )
736
736
737
- if E != None and len (shape (E )) == 1 :
737
+ if E is not None and len (shape (E )) == 1 :
738
738
E = E .reshape (1 ,E .size )
739
739
740
740
# Determine main dimensions
@@ -749,7 +749,7 @@ def dare_old(A,B,Q,R,S=None,E=None):
749
749
m = size (B ,1 )
750
750
751
751
# Solve the standard algebraic Riccati equation
752
- if S == None and E == None :
752
+ if S is None and E is None :
753
753
# Check input data for consistency
754
754
if size (A ) > 1 and shape (A )[0 ] != shape (A )[1 ]:
755
755
raise ControlArgument ("A must be a quadratic matrix." )
@@ -833,7 +833,7 @@ def dare_old(A,B,Q,R,S=None,E=None):
833
833
return (X , w [:n ] , G )
834
834
835
835
# Solve the generalized algebraic Riccati equation
836
- elif S != None and E != None :
836
+ elif S is not None and E is not None :
837
837
# Check input data for consistency
838
838
if size (A ) > 1 and shape (A )[0 ] != shape (A )[1 ]:
839
839
raise ControlArgument ("A must be a quadratic matrix." )
0 commit comments