@@ -88,10 +88,10 @@ def lyap(A,Q,C=None,E=None):
8888 if len (shape (Q )) == 1 :
8989 Q = Q .reshape (1 ,Q .size )
9090
91- if C != None and len (shape (C )) == 1 :
91+ if C is not None and len (shape (C )) == 1 :
9292 C = C .reshape (1 ,C .size )
9393
94- if E != None and len (shape (E )) == 1 :
94+ if E is not None and len (shape (E )) == 1 :
9595 E = E .reshape (1 ,E .size )
9696
9797 # Determine main dimensions
@@ -106,7 +106,7 @@ def lyap(A,Q,C=None,E=None):
106106 m = size (Q ,0 )
107107
108108 # Solve standard Lyapunov equation
109- if C == None and E == None :
109+ if C is None and E is None :
110110 # Check input data for consistency
111111 if shape (A ) != shape (Q ):
112112 raise ControlArgument ("A and Q must be matrices of identical \
@@ -139,7 +139,7 @@ def lyap(A,Q,C=None,E=None):
139139 raise e
140140
141141 # Solve the Sylvester equation
142- elif C != None and E == None :
142+ elif C is not None and E is None :
143143 # Check input data for consistency
144144 if size (A ) > 1 and shape (A )[0 ] != shape (A )[1 ]:
145145 raise ControlArgument ("A must be a quadratic matrix." )
@@ -170,7 +170,7 @@ def lyap(A,Q,C=None,E=None):
170170 raise e
171171
172172 # Solve the generalized Lyapunov equation
173- elif C == None and E != None :
173+ elif C is None and E is not None :
174174 # Check input data for consistency
175175 if (size (Q ) > 1 and shape (Q )[0 ] != shape (Q )[1 ]) or \
176176 (size (Q ) > 1 and shape (Q )[0 ] != n ) or \
@@ -275,10 +275,10 @@ def dlyap(A,Q,C=None,E=None):
275275 if len (shape (Q )) == 1 :
276276 Q = Q .reshape (1 ,Q .size )
277277
278- if C != None and len (shape (C )) == 1 :
278+ if C is not None and len (shape (C )) == 1 :
279279 C = C .reshape (1 ,C .size )
280280
281- if E != None and len (shape (E )) == 1 :
281+ if E is not None and len (shape (E )) == 1 :
282282 E = E .reshape (1 ,E .size )
283283
284284 # Determine main dimensions
@@ -293,7 +293,7 @@ def dlyap(A,Q,C=None,E=None):
293293 m = size (Q ,0 )
294294
295295 # Solve standard Lyapunov equation
296- if C == None and E == None :
296+ if C is None and E is None :
297297 # Check input data for consistency
298298 if shape (A ) != shape (Q ):
299299 raise ControlArgument ("A and Q must be matrices of identical \
@@ -322,7 +322,7 @@ def dlyap(A,Q,C=None,E=None):
322322 raise e
323323
324324 # Solve the Sylvester equation
325- elif C != None and E == None :
325+ elif C is not None and E is None :
326326 # Check input data for consistency
327327 if size (A ) > 1 and shape (A )[0 ] != shape (A )[1 ]:
328328 raise ControlArgument ("A must be a quadratic matrix" )
@@ -353,7 +353,7 @@ def dlyap(A,Q,C=None,E=None):
353353 raise e
354354
355355 # Solve the generalized Lyapunov equation
356- elif C == None and E != None :
356+ elif C is None and E is not None :
357357 # Check input data for consistency
358358 if (size (Q ) > 1 and shape (Q )[0 ] != shape (Q )[1 ]) or \
359359 (size (Q ) > 1 and shape (Q )[0 ] != n ) or \
@@ -458,13 +458,13 @@ def care(A,B,Q,R=None,S=None,E=None):
458458 if len (shape (Q )) == 1 :
459459 Q = Q .reshape (1 ,Q .size )
460460
461- if R != None and len (shape (R )) == 1 :
461+ if R is not None and len (shape (R )) == 1 :
462462 R = R .reshape (1 ,R .size )
463463
464- if S != None and len (shape (S )) == 1 :
464+ if S is not None and len (shape (S )) == 1 :
465465 S = S .reshape (1 ,S .size )
466466
467- if E != None and len (shape (E )) == 1 :
467+ if E is not None and len (shape (E )) == 1 :
468468 E = E .reshape (1 ,E .size )
469469
470470 # Determine main dimensions
@@ -477,11 +477,11 @@ def care(A,B,Q,R=None,S=None,E=None):
477477 m = 1
478478 else :
479479 m = size (B ,1 )
480- if R == None :
480+ if R is None :
481481 R = eye (m ,m )
482482
483483 # Solve the standard algebraic Riccati equation
484- if S == None and E == None :
484+ if S is None and E is None :
485485 # Check input data for consistency
486486 if size (A ) > 1 and shape (A )[0 ] != shape (A )[1 ]:
487487 raise ControlArgument ("A must be a quadratic matrix." )
@@ -562,7 +562,7 @@ def care(A,B,Q,R=None,S=None,E=None):
562562 return (X , w [:n ] , G )
563563
564564 # Solve the generalized algebraic Riccati equation
565- elif S != None and E != None :
565+ elif S is not None and E is not None :
566566 # Check input data for consistency
567567 if size (A ) > 1 and shape (A )[0 ] != shape (A )[1 ]:
568568 raise ControlArgument ("A must be a quadratic matrix." )
@@ -728,13 +728,13 @@ def dare_old(A,B,Q,R,S=None,E=None):
728728 if len (shape (Q )) == 1 :
729729 Q = Q .reshape (1 ,Q .size )
730730
731- if R != None and len (shape (R )) == 1 :
731+ if R is not None and len (shape (R )) == 1 :
732732 R = R .reshape (1 ,R .size )
733733
734- if S != None and len (shape (S )) == 1 :
734+ if S is not None and len (shape (S )) == 1 :
735735 S = S .reshape (1 ,S .size )
736736
737- if E != None and len (shape (E )) == 1 :
737+ if E is not None and len (shape (E )) == 1 :
738738 E = E .reshape (1 ,E .size )
739739
740740 # Determine main dimensions
@@ -749,7 +749,7 @@ def dare_old(A,B,Q,R,S=None,E=None):
749749 m = size (B ,1 )
750750
751751 # Solve the standard algebraic Riccati equation
752- if S == None and E == None :
752+ if S is None and E is None :
753753 # Check input data for consistency
754754 if size (A ) > 1 and shape (A )[0 ] != shape (A )[1 ]:
755755 raise ControlArgument ("A must be a quadratic matrix." )
@@ -833,7 +833,7 @@ def dare_old(A,B,Q,R,S=None,E=None):
833833 return (X , w [:n ] , G )
834834
835835 # Solve the generalized algebraic Riccati equation
836- elif S != None and E != None :
836+ elif S is not None and E is not None :
837837 # Check input data for consistency
838838 if size (A ) > 1 and shape (A )[0 ] != shape (A )[1 ]:
839839 raise ControlArgument ("A must be a quadratic matrix." )
0 commit comments