Accord.Tests.Statistics.QuadraticTest.ExpandDistanceWithConstantTest C# (CSharp) Method

ExpandDistanceWithConstantTest() private method

private ExpandDistanceWithConstantTest ( ) : void
return void
        public void ExpandDistanceWithConstantTest()
        {
            Quadratic kernel = new Quadratic(4.2);

            var x = new double[] { 0.5, 2.0 };
            var y = new double[] { 1.3, -0.2 };

            var phi_x = kernel.Transform(x);
            var phi_y = kernel.Transform(y);

            double d1 = Distance.SquareEuclidean(phi_x, phi_y);
            double d2 = kernel.Distance(x, y);
            double d3 = Accord.Statistics.Tools.Distance(kernel, x, y);

            Assert.AreEqual(66.9624, d1);
            Assert.AreEqual(66.9624, d2, 1e-10);
            Assert.AreEqual(66.9624, d3, 1e-10);

            Assert.IsFalse(double.IsNaN(d1));
            Assert.IsFalse(double.IsNaN(d2));
            Assert.IsFalse(double.IsNaN(d3));
        }