code: public static FloatMatrix pairwiseSquaredDistances(FloatMatrix X, FloatMatrix Y) {
  		if (X.rows != Y.rows)
  			throw new IllegalArgumentException(
  					"Matrices must have same number of rows");
  	
  		FloatMatrix XX = X.mul(X).columnSums();
  		FloatMatrix YY = Y.mul(Y).columnSums();
  	
  		FloatMatrix Z = X.transpose().mmul(Y);
  		Z.muli(-2.0f); //Z.print();
  		Z.addiColumnVector(XX);
  		Z.addiRowVector(YY);
  	
  		return Z;
  	}
docs: <p>Compute the pairwise squared distances between all columns of the two
  matrices.</p>
  
  <p>An efficient way to do this is to observe that <i>(x-y)^2 = x^2 - 2xy - y^2</i>
  and to then properly carry out the computation with matrices.</p>