def compute_corr(x, y):
 if ((len(x) == 0) or (len(y) == 0)):
  raise ValueError('x or y has zero length')
 fast_dot = _get_fast_dot()
 X = np.array(x, float)
 Y = np.array(y, float)
 X -= X.mean(0)
 Y -= Y.mean(0)
 x_sd = X.std(0, ddof=1)
 y_sd = Y.std(0, ddof=1)[:, (None if (X.shape == Y.shape) else Ellipsis)]
 return ((fast_dot(X.T, Y) / float((len(X) - 1))) / (x_sd * y_sd))

def compute_corr ( x , y ) : if ( ( len ( x ) == 0 ) or ( len ( y ) == 0 ) ) : raise ValueError ( 'x or y has zero length' ) fast_dot = _get_fast_dot ( ) X = np . array ( x , float ) Y = np . array ( y , float ) X -= X . mean ( 0 ) Y -= Y . mean ( 0 ) x_sd = X . std ( 0 , ddof = 1 ) y_sd = Y . std ( 0 , ddof = 1 ) [ : , ( None if ( X . shape == Y . shape ) else Ellipsis ) ] return ( ( fast_dot ( X . T , Y ) / float ( ( len ( X ) - 1 ) ) ) / ( x_sd * y_sd ) )
compute pearson correlations between a vector and a matrix .