@Override
    public double d(double[] x, double[] y) {
        return cor.applyAsDouble(x, y);
    }
@Test
    public void testDistance() {
        System.out.println("distance");
        double[] x = {1.0, 2.0, 3.0, 4.0};
        double[] y = {4.0, 3.0, 2.0, 1.0};
        double[] z = {4.0, 2.0, 3.0, 1.0};
        double[] w = {-2.1968219, -0.9559913, -0.0431738,  1.0567679,  0.3853515};
        double[] v = {-1.7781325, -0.6659839,  0.9526148, -0.9460919, -0.3925300};
        CorrelationDistance cor = new CorrelationDistance();
        assertEquals(0.0, cor.d(x, x), 1E-5);
        assertEquals(2.0, cor.d(x, y), 1E-5);
        assertEquals(0.2, cor.d(y, z), 1E-5);
        assertEquals(0.5313153, cor.d(w, v), 1E-7);
    }