def expm_cond(A, check_finite=True):
 if check_finite:
  A = np.asarray_chkfinite(A)
 else:
  A = np.asarray(A)
 if ((len(A.shape) != 2) or (A.shape[0] != A.shape[1])):
  raise ValueError('expected a square matrix')
 X = scipy.linalg.expm(A)
 K = expm_frechet_kronform(A, check_finite=False)
 A_norm = scipy.linalg.norm(A, 'fro')
 X_norm = scipy.linalg.norm(X, 'fro')
 K_norm = scipy.linalg.norm(K, 2)
 kappa = ((K_norm * A_norm) / X_norm)
 return kappa

def expm_cond ( A , check_finite = True ) : if check_finite : A = np . asarray_chkfinite ( A ) else : A = np . asarray ( A ) if ( ( len ( A . shape ) != 2 ) or ( A . shape [ 0 ] != A . shape [ 1 ] ) ) : raise ValueError ( 'expected a square matrix' ) X = scipy . linalg . expm ( A ) K = expm_frechet_kronform ( A , check_finite = False ) A_norm = scipy . linalg . norm ( A , 'fro' ) X_norm = scipy . linalg . norm ( X , 'fro' ) K_norm = scipy . linalg . norm ( K , 2 ) kappa = ( ( K_norm * A_norm ) / X_norm ) return kappa
relative condition number of the matrix exponential in the frobenius norm .