#NEWLINE# def _unscaled_dist( self , X , X2 = None ) : #NEWLINE# #INDENT# '\n        Compute the Euclidean distance between each row of X and X2, or between\n        each pair of rows of X if X2 is None.\n        ' #NEWLINE# if ( X2 is None ) : #NEWLINE# #INDENT# Xsq = np . sum ( np . square ( X ) , 1 ) #NEWLINE# r2 = ( ( ( - 2.0 ) * tdot ( X ) ) + ( Xsq [ : , None ] + Xsq [ None , : ] ) ) #NEWLINE# util . diag . view ( r2 ) [ : ] = 0.0 #NEWLINE# r2 = np . clip ( r2 , 0 , np . inf ) #NEWLINE# return np . sqrt ( r2 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# X1sq = np . sum ( np . square ( X ) , 1 ) #NEWLINE# X2sq = np . sum ( np . square ( self ) , 1 ) #NEWLINE# r2 = ( ( ( ( - 2.0 ) * np . dot ( X , X2 . T ) ) + X1sq [ : , None ] ) + X2sq [ None , : ] ) #NEWLINE# r2 = np . clip ( r2 , 0 , np . inf ) #NEWLINE# return np . sqrt ( r2 )