def solve_discrete_lyapunov(a, q, method=None):
 a = np.asarray(a)
 q = np.asarray(q)
 if (method is None):
  if (a.shape[0] >= 10):
   method = 'bilinear'
  else:
   method = 'direct'
 meth = method.lower()
 if (meth == 'direct'):
  x = _solve_discrete_lyapunov_direct(a, q)
 elif (meth == 'bilinear'):
  x = _solve_discrete_lyapunov_bilinear(a, q)
 else:
  raise ValueError(('Unknown solver %s' % method))
 return x

def solve_discrete_lyapunov ( a , q , method = None ) : a = np . asarray ( a ) q = np . asarray ( q ) if ( method is None ) : if ( a . shape [ 0 ] >= 10 ) : method = 'bilinear' else : method = 'direct' meth = method . lower ( ) if ( meth == 'direct' ) : x = _solve_discrete_lyapunov_direct ( a , q ) elif ( meth == 'bilinear' ) : x = _solve_discrete_lyapunov_bilinear ( a , q ) else : raise ValueError ( ( 'Unknown solver %s' % method ) ) return x
solves the discrete lyapunov equation :math:axa^h - x + q = 0 .