asmk.py
def L2(x,y):
    '''
    x,y: 2 matrices, each row is a data
    return L2 distance matrix of x and y
    '''
    xx = np.sum(x*x,axis=1,keepdims=1) # row*1
    yy = np.sum(y*y,axis=1,keepdims=1) # row*1
    xy = x.dot(y.T)                    # row*row
    
    x2 = repmat(xx.T,len(yy),1)        # row*row
    y2 = repmat(yy,1,len(xx))          # row*row
    d = x2 + y2 - 2*xy    
    return d

    x,y: 2 matrices, each row is a data
    return L2 distance matrix of x and y
    
x,y: 2 matrices, each row is a data
return L2 distance matrix of x and y
x y : 2 matrices each row is a data return L2 distance matrix of x and y
def L2(x,y):
    xx = np.sum(x*x,axis=1,keepdims=1) 
    yy = np.sum(y*y,axis=1,keepdims=1) 
    xy = x.dot(y.T)                    
    x2 = repmat(xx.T,len(yy),1)        
    y2 = repmat(yy,1,len(xx))          
    d = x2 + y2 - 2*xy    
    return d
def L2 ( x , y ) : xx = np . sum ( x * x , axis = 1 , keepdims = 1 ) yy = np . sum ( y * y , axis = 1 , keepdims = 1 ) xy = x . dot ( y . T ) x2 = repmat ( xx . T , len ( yy ) , 1 ) y2 = repmat ( yy , 1 , len ( xx ) ) d = x2 + y2 - 2 * xy return d
x,y: 2 matrices, each row is a data
return L2 distance matrix of x and y
x y : 2 matrices each row is a data return L2 distance matrix of x and y
'''
    x,y: 2 matrices, each row is a data
    return L2 distance matrix of x and y
    ''' # row*1 # row*1 # row*row # row*row # row*row
x
y