@Test public void testCalDistanceVecMatrix() { FastDistanceMatrixData matrixData = initMatrixData(); FastDistanceVectorData vectorData = distance.prepareVectorData(Row.of(0, sparseVector1), 1); double[] predict = distance.calc(matrixData, vectorData).getData(); double[] expect = new double[] {10.5, 16.5}; for (int i = 0; i < expect.length; i++) { Assert.assertEquals(expect[i], predict[i], 0.01); } predict = distance.calc(vectorData, matrixData).getData(); for (int i = 0; i < expect.length; i++) { Assert.assertEquals(expect[i], predict[i], 0.01); } }
@Override public double calc(double[] vec1, double[] vec2) { return calc(vec1, 0, vec2, 0, vec1.length); }
ManHattanDistance extends FastDistance { @Override public double calc(double[] vec1, double[] vec2) { return calc(vec1, 0, vec2, 0, vec1.length); } }
ManHattanDistance extends FastDistance { @Override public double calc(double[] vec1, double[] vec2) { return calc(vec1, 0, vec2, 0, vec1.length); }  }
ManHattanDistance extends FastDistance { @Override public double calc(double[] vec1, double[] vec2) { return calc(vec1, 0, vec2, 0, vec1.length); }  @Override double calc(double[] vec1, double[] vec2); @Override double calc(Vector vec1, Vector vec2); @Override void updateLabel(FastDistanceData data); }
ManHattanDistance extends FastDistance { @Override public double calc(double[] vec1, double[] vec2) { return calc(vec1, 0, vec2, 0, vec1.length); }  @Override double calc(double[] vec1, double[] vec2); @Override double calc(Vector vec1, Vector vec2); @Override void updateLabel(FastDistanceData data);  }