def logm(A, disp=True):
 A = _asarray_square(A)
 import scipy.linalg._matfuncs_inv_ssq
 F = scipy.linalg._matfuncs_inv_ssq._logm(A)
 F = _maybe_real(A, F)
 errtol = (1000 * eps)
 errest = (norm((expm(F) - A), 1) / norm(A, 1))
 if disp:
  if ((not isfinite(errest)) or (errest >= errtol)):
   print('logm result may be inaccurate, approximate err =', errest)
  return F
 else:
  return (F, errest)

def logm ( A , disp = True ) : A = _asarray_square ( A ) import scipy . linalg . _matfuncs_inv_ssq F = scipy . linalg . _matfuncs_inv_ssq . _logm ( A ) F = _maybe_real ( A , F ) errtol = ( 1000 * eps ) errest = ( norm ( ( expm ( F ) - A ) , 1 ) / norm ( A , 1 ) ) if disp : if ( ( not isfinite ( errest ) ) or ( errest >= errtol ) ) : print ( 'logm result may be inaccurate, approximate err =' , errest ) return F else : return ( F , errest )
compute matrix logarithm .