def logdet_symm(m, check_symm=False):
 from scipy import linalg
 if check_symm:
  if (not np.all((m == m.T))):
   raise ValueError('m is not symmetric.')
 (c, _) = linalg.cho_factor(m, lower=True)
 return (2 * np.sum(np.log(c.diagonal())))

def logdet_symm ( m , check_symm = False ) : from scipy import linalg if check_symm : if ( not np . all ( ( m == m . T ) ) ) : raise ValueError ( 'm is not symmetric.' ) ( c , _ ) = linalg . cho_factor ( m , lower = True ) return ( 2 * np . sum ( np . log ( c . diagonal ( ) ) ) )
return log(det(m)) asserting positive definiteness of m .