def multinomial_logpmf_vec(x, n, p):
 if (len(x.shape) == 1):
  return multinomial_logpmf(x, n, p)
 else:
  size = x.shape[0]
  return np.array([multinomial_logpmf(x[i, :], n, p) for i in range(size)])

def multinomial_logpmf_vec ( x , n , p ) : if ( len ( x . shape ) == 1 ) : return multinomial_logpmf ( x , n , p ) else : size = x . shape [ 0 ] return np . array ( [ multinomial_logpmf ( x [ i , : ] , n , p ) for i in range ( size ) ] )
vectorized version of multinomial_logpmf .