def gauss(m, v, x):
 if (len(x.shape) == 1):
  (n, d) = (1, x.shape[0])
 else:
  (n, d) = x.shape
 S = diag((1 / v))
 x = (x - m)
 y = exp(((-0.5) * diag(dot(x, dot(S, x.T)))))
 return ((y * ((2 * pi) ** ((- d) / 2.0))) / (sqrt(prod(v)) + 1e-06))

def gauss ( m , v , x ) : if ( len ( x . shape ) == 1 ) : ( n , d ) = ( 1 , x . shape [ 0 ] ) else : ( n , d ) = x . shape S = diag ( ( 1 / v ) ) x = ( x - m ) y = exp ( ( ( - 0.5 ) * diag ( dot ( x , dot ( S , x . T ) ) ) ) ) return ( ( y * ( ( 2 * pi ) ** ( ( - d ) / 2.0 ) ) ) / ( sqrt ( prod ( v ) ) + 1e-06 ) )
evaluate gaussian in d-dimensions with independent mean m and variance v at the points in x .