def pairwise(X):
    M = X.shape[0]
    N = X.shape[1]
    D = numpy.zeros((M,N))
    "omp parallel for private(i,j,d,k,tmp)"
    for i in xrange(M):
        for j in xrange(M):
            d = 0.0
            for k in xrange(N):
                tmp = X[i,k] - X[j,k]
                d += tmp * tmp
            D[i,j] = math.sqrt(d)
    return D
def pairwise ( X ) : M = X . shape [ 0 ] N = X . shape [ 1 ] D = numpy . zeros ( ( M , N ) ) for i in xrange ( M ) : for j in xrange ( M ) : d = 0.0 for k in xrange ( N ) : tmp = X [ i , k ] - X [ j , k ] d += tmp * tmp D [ i , j ] = math . sqrt ( d ) return D
omp parallel for private(i,j,d,k,tmp)