@@ -81,7 +81,7 @@ def _warn_ill_conditioned_E(E):
8181#
8282
8383
84- def lyap (A , Q , C = None , E = None , method = None , ** kwargs ):
84+ def lyap (A , Q , C = None , E = None , method = None , symmetric_kwargs = None ):
8585 """Solves the continuous-time Lyapunov equation.
8686
8787 X = lyap(A, Q) solves
@@ -147,11 +147,6 @@ def lyap(A, Q, C=None, E=None, method=None, **kwargs):
147147
148148 """
149149
150- symmetric_kwargs = kwargs .pop ("symmetric_kwargs" , {})
151-
152- # Make sure there were no extraneous keywords
153- if kwargs :
154- raise TypeError ("unrecognized keyword(s): " , str (kwargs ))
155150 # Decide what method to use
156151 method = _slycot_or_scipy (method )
157152 if method == 'slycot' :
@@ -252,7 +247,7 @@ def lyap(A, Q, C=None, E=None, method=None, **kwargs):
252247 return X
253248
254249
255- def dlyap (A , Q , C = None , E = None , method = None , ** kwargs ):
250+ def dlyap (A , Q , C = None , E = None , method = None , symmetric_kwargs = None ):
256251 """Solves the discrete-time Lyapunov equation.
257252
258253 X = dlyap(A, Q) solves
@@ -329,10 +324,6 @@ def dlyap(A, Q, C=None, E=None, method=None, **kwargs):
329324
330325 """
331326
332- symmetric_kwargs = kwargs .pop ("symmetric_kwargs" , {})
333- # Make sure there were no extraneous keywords
334- if kwargs :
335- raise TypeError ("unrecognized keyword(s): " , str (kwargs ))
336327 # Decide what method to use
337328 method = _slycot_or_scipy (method )
338329
@@ -466,8 +457,8 @@ def dlyap(A, Q, C=None, E=None, method=None, **kwargs):
466457# Riccati equation solvers care and dare
467458#
468459
469- def care (A , B , Q , R = None , S = None , E = None , stabilizing = True , method = None ,
470- _As = "A" , _Bs = "B" , _Qs = "Q" , _Rs = "R" , _Ss = "S" , _Es = "E" , ** kwargs ):
460+ def care (A , B , Q , R = None , S = None , E = None , stabilizing = True , method = None , symmetric_kwargs = None ,
461+ _As = "A" , _Bs = "B" , _Qs = "Q" , _Rs = "R" , _Ss = "S" , _Es = "E" , ):
471462 """Solves the continuous-time algebraic Riccati equation.
472463
473464 X, L, G = care(A, B, Q, R=None) solves
@@ -519,12 +510,6 @@ def care(A, B, Q, R=None, S=None, E=None, stabilizing=True, method=None,
519510
520511 """
521512
522- symmetric_kwargs = kwargs .pop ("symmetric_kwargs" , {})
523-
524- # Make sure there were no extraneous keywords
525- if kwargs :
526- raise TypeError ("unrecognized keyword(s): " , str (kwargs ))
527-
528513 # Decide what method to use
529514 method = _slycot_or_scipy (method )
530515
@@ -632,8 +617,8 @@ def care(A, B, Q, R=None, S=None, E=None, stabilizing=True, method=None,
632617 # the gain matrix G
633618 return X , L , G
634619
635- def dare (A , B , Q , R , S = None , E = None , stabilizing = True , method = None ,
636- _As = "A" , _Bs = "B" , _Qs = "Q" , _Rs = "R" , _Ss = "S" , _Es = "E" , ** kwargs ):
620+ def dare (A , B , Q , R , S = None , E = None , stabilizing = True , method = None , symmetric_kwargs = None ,
621+ _As = "A" , _Bs = "B" , _Qs = "Q" , _Rs = "R" , _Ss = "S" , _Es = "E" ):
637622 """Solves the discrete-time algebraic Riccati equation.
638623
639624 X, L, G = dare(A, B, Q, R) solves
@@ -685,12 +670,6 @@ def dare(A, B, Q, R, S=None, E=None, stabilizing=True, method=None,
685670
686671 """
687672
688- symmetric_kwargs = kwargs .pop ("symmetric_kwargs" , {})
689-
690- # Make sure there were no extraneous keywords
691- if kwargs :
692- raise TypeError ("unrecognized keyword(s): " , str (kwargs ))
693-
694673 # Decide what method to use
695674 method = _slycot_or_scipy (method )
696675
@@ -777,8 +756,7 @@ def _slycot_or_scipy(method):
777756
778757
779758# Utility function to check matrix dimensions
780- def _check_shape (M , n , m , square = False , symmetric = False , name = "??" ,
781- symmetric_kwargs = None ):
759+ def _check_shape (M , n , m , square = False , symmetric = False , name = "??" , symmetric_kwargs = None ):
782760 """Check the shape and properties of a 2D array.
783761
784762 This function can be used to check to make sure a 2D array_like has the
@@ -824,12 +802,9 @@ def _check_shape(M, n, m, square=False, symmetric=False, name="??",
824802
825803# Utility function to check if a matrix is symmetric
826804def _is_symmetric (M , symmetric_kwargs = None ):
827- M = np .atleast_2d (M )
828- symmetric_kwargs = (
829- symmetric_kwargs .copy () if symmetric_kwargs else {}
830- )
805+ if symmetric_kwargs is None :
806+ symmetric_kwargs = {}
831807
832808 if np .iscomplexobj (M ):
833809 return sp .linalg .ishermitian (M , ** symmetric_kwargs )
834- else :
835- return sp .linalg .issymmetric (M , ** symmetric_kwargs )
810+ return sp .linalg .issymmetric (M , ** symmetric_kwargs )
0 commit comments