def multigammaln(a, d):
 a = np.asarray(a)
 if ((not np.isscalar(d)) or (np.floor(d) != d)):
  raise ValueError('d should be a positive integer (dimension)')
 if np.any((a <= (0.5 * (d - 1)))):
  raise ValueError(('condition a (%f) > 0.5 * (d-1) (%f) not met' % (a, (0.5 * (d - 1)))))
 res = (((d * (d - 1)) * 0.25) * np.log(np.pi))
 res += np.sum(loggam([(a - ((j - 1.0) / 2)) for j in range(1, (d + 1))]), axis=0)
 return res

def multigammaln ( a , d ) : a = np . asarray ( a ) if ( ( not np . isscalar ( d ) ) or ( np . floor ( d ) != d ) ) : raise ValueError ( 'd should be a positive integer (dimension)' ) if np . any ( ( a <= ( 0.5 * ( d - 1 ) ) ) ) : raise ValueError ( ( 'condition a (%f) > 0.5 * (d-1) (%f) not met' % ( a , ( 0.5 * ( d - 1 ) ) ) ) ) res = ( ( ( d * ( d - 1 ) ) * 0.25 ) * np . log ( np . pi ) ) res += np . sum ( loggam ( [ ( a - ( ( j - 1.0 ) / 2 ) ) for j in range ( 1 , ( d + 1 ) ) ] ) , axis = 0 ) return res
multivariate log gamma .