@Test public void testContinuousDistance() { Assert.assertEquals(distance.calc(denseVector1, denseVector2), 6.0, 0.01); Assert.assertEquals(distance.calc(denseVector1.getData(), denseVector2.getData()), 6.0, 0.01); Assert.assertEquals(distance.calc(denseVector1, sparseVector1), 5.47, 0.01); Assert.assertEquals(distance.calc(sparseVector1, sparseVector2), 0.50, 0.01); Assert.assertEquals(distance.calc(sparseVector1, denseVector2), 8.38, 0.01); }
@Override public double calc(double[] array1, double[] array2) { double s = 0.; for (int i = 0; i < array1.length; i++) { double d = array1[i] - array2[i]; s += d * d; } return Math.sqrt(s); }
EuclideanDistance extends FastDistance { @Override public double calc(double[] array1, double[] array2) { double s = 0.; for (int i = 0; i < array1.length; i++) { double d = array1[i] - array2[i]; s += d * d; } return Math.sqrt(s); } }
EuclideanDistance extends FastDistance { @Override public double calc(double[] array1, double[] array2) { double s = 0.; for (int i = 0; i < array1.length; i++) { double d = array1[i] - array2[i]; s += d * d; } return Math.sqrt(s); }  }
EuclideanDistance extends FastDistance { @Override public double calc(double[] array1, double[] array2) { double s = 0.; for (int i = 0; i < array1.length; i++) { double d = array1[i] - array2[i]; s += d * d; } return Math.sqrt(s); }  @Override double calc(double[] array1, double[] array2); @Override double calc(Vector vec1, Vector vec2); @Override void updateLabel(FastDistanceData data); }
EuclideanDistance extends FastDistance { @Override public double calc(double[] array1, double[] array2) { double s = 0.; for (int i = 0; i < array1.length; i++) { double d = array1[i] - array2[i]; s += d * d; } return Math.sqrt(s); }  @Override double calc(double[] array1, double[] array2); @Override double calc(Vector vec1, Vector vec2); @Override void updateLabel(FastDistanceData data);  }