///
        public virtual void localMonotonicityIncTest()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double[] xValues = new double[] {2.0, 3.0, 5.0, 8.0, 9.0, 13.0 };
            double[] xValues = new double[] { 2.0, 3.0, 5.0, 8.0, 9.0, 13.0 };
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double[] yValues = new double[] {1.0, 1.01, 2.0, 2.1, 2.2, 2.201 };
            double[] yValues = new double[] { 1.0, 1.01, 2.0, 2.1, 2.2, 2.201 };

            PiecewisePolynomialInterpolator interp = new NaturalSplineInterpolator();
            PiecewisePolynomialResult       result = interp.interpolate(xValues, yValues);

            PiecewisePolynomialFunction1D function = new PiecewisePolynomialFunction1D();

            PiecewisePolynomialInterpolator interpPos = new MonotonicityPreservingCubicSplineInterpolator(interp);
            PiecewisePolynomialResult       resultPos = interpPos.interpolate(xValues, yValues);

            assertEquals(resultPos.Dimensions, result.Dimensions);
            assertEquals(resultPos.NumberOfIntervals, result.NumberOfIntervals);
            assertEquals(resultPos.Order, result.Order);

            const int nKeys = 111;
            double    key0  = 2.0;

            for (int i = 1; i < nKeys; ++i)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double key = 2.0 + 11.0 / (nKeys - 1) * i;
                double key = 2.0 + 11.0 / (nKeys - 1) * i;
                assertTrue(function.evaluate(resultPos, key).get(0) - function.evaluate(resultPos, key0).get(0) >= 0.0);

                key0 = 2.0 + 11.0 / (nKeys - 1) * i;
            }
        }
Пример #2
0
        ///
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void NanOutputTest()
        public virtual void NanOutputTest()
        {
            double[] xValues = new double[] { 1.0, 2.e-308, 3.e-308, 4.0 };
            double[] yValues = new double[] { 1.0, 2.0, 1.e308, 3.0 };

            NaturalSplineInterpolator interp = new NaturalSplineInterpolator();

            interp.interpolate(xValues, yValues);
        }
Пример #3
0
        ///
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void coincideXvaluesTest()
        public virtual void coincideXvaluesTest()
        {
            double[] xValues = new double[] { 1.0, 2.0, 3.0, 3.0 };
            double[] yValues = new double[] { 1.0, 2.0, 3.0, 4.0 };

            NaturalSplineInterpolator interp = new NaturalSplineInterpolator();

            interp.interpolate(xValues, yValues);
        }
Пример #4
0
        ///
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void shortDataLengthTest()
        public virtual void shortDataLengthTest()
        {
            double[] xValues = new double[] { 1.0 };
            double[] yValues = new double[] { 4.0 };

            NaturalSplineInterpolator interp = new NaturalSplineInterpolator();

            interp.interpolate(xValues, yValues);
        }
Пример #5
0
        ///
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void wrongDatalengthTest()
        public virtual void wrongDatalengthTest()
        {
            double[] xValues = new double[] { 1.0, 2.0, 3.0 };
            double[] yValues = new double[] { 1.0, 2.0, 3.0, 4.0 };

            NaturalSplineInterpolator interp = new NaturalSplineInterpolator();

            interp.interpolate(xValues, yValues);
        }
Пример #6
0
        ///
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void NullKeyTest()
        public virtual void NullKeyTest()
        {
            double[] xValues = new double[] { 1.0, 2.0, 3.0 };
            double[] yValues = new double[] { 1.0, 3.0, 4.0 };
            double[] xKey    = new double[3];

            xKey = null;

            NaturalSplineInterpolator interp = new NaturalSplineInterpolator();

            interp.interpolate(xValues, yValues, xKey);
        }
Пример #7
0
        ///
        public virtual void recov4ptsMultiTest()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double[] xValues = new double[] {1.0, 2.0, 3.0, 4 };
            double[] xValues = new double[] { 1.0, 2.0, 3.0, 4 };
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double[][] yValues = new double[][] { {6.0, 25.0 / 6.0, 10.0 / 3.0, 4.0 }, {6.0, 1.0, 0.0, 0.0 } };
            double[][] yValues = new double[][]
            {
                new double[] { 6.0, 25.0 / 6.0, 10.0 / 3.0, 4.0 },
                new double[] { 6.0, 1.0, 0.0, 0.0 }
            };

            const int nIntervalsExp = 3;
            const int orderExp      = 4;
            const int dimExp        = 2;

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double[][] coefsMatExp = new double[][] { {1.0 / 6.0, 0.0, -2.0, 6.0 }, {1.0, 0.0, -6.0, 6.0 }, {1.0 / 6.0, 1.0 / 2.0, -3.0 / 2.0, 25.0 / 6.0 }, {-1.0, 3.0, -3.0, 1.0 }, {-1.0 / 3.0, 1.0, 0.0, 10.0 / 3.0 }, {0.0, 0.0, 0.0, 0 } };
            double[][] coefsMatExp = new double[][]
            {
                new double[] { 1.0 / 6.0, 0.0, -2.0, 6.0 },
                new double[] { 1.0, 0.0, -6.0, 6.0 },
                new double[] { 1.0 / 6.0, 1.0 / 2.0, -3.0 / 2.0, 25.0 / 6.0 },
                new double[] { -1.0, 3.0, -3.0, 1.0 },
                new double[] { -1.0 / 3.0, 1.0, 0.0, 10.0 / 3.0 },
                new double[] { 0.0, 0.0, 0.0, 0 }
            };

            NaturalSplineInterpolator interpMatrix = new NaturalSplineInterpolator();

            PiecewisePolynomialResult result = interpMatrix.interpolate(xValues, yValues);

            assertEquals(result.Dimensions, dimExp);
            assertEquals(result.NumberOfIntervals, nIntervalsExp);
            assertEquals(result.Dimensions, dimExp);

            for (int i = 0; i < nIntervalsExp * dimExp; ++i)
            {
                for (int j = 0; j < orderExp; ++j)
                {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double ref = coefsMatExp[i][j] == 0.0 ? 1.0 : Math.abs(coefsMatExp[i][j]);
                    double @ref = coefsMatExp[i][j] == 0.0 ? 1.0 : Math.Abs(coefsMatExp[i][j]);
                    assertEquals(result.CoefMatrix.get(i, j), coefsMatExp[i][j], @ref * EPS);
                }
            }

            for (int j = 0; j < nIntervalsExp + 1; ++j)
            {
                assertEquals(result.Knots.get(j), xValues[j]);
            }
        }
Пример #8
0
        ///
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void InfiniteOutputMultiTest()
        public virtual void InfiniteOutputMultiTest()
        {
            double[]   xValues = new double[] { 1.e-308, 2.e-308 };
            double[][] yValues = new double[][]
            {
                new double[] { 1.0, 1.e308 },
                new double[] { 2.0, 1.0 }
            };

            NaturalSplineInterpolator interp = new NaturalSplineInterpolator();

            interp.interpolate(xValues, yValues);
        }
Пример #9
0
        ///
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void InfyValuesMultiTest()
        public virtual void InfyValuesMultiTest()
        {
            double[]   xValues = new double[] { 1.0, 2.0, 3.0, 4.0 };
            double[][] yValues = new double[][]
            {
                new double[] { 1.0, 2.0, 3.0, 4.0 },
                new double[] { 1.0, 2.0, 3.0, INF }
            };

            NaturalSplineInterpolator interp = new NaturalSplineInterpolator();

            interp.interpolate(xValues, yValues);
        }
Пример #10
0
        ///
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void NullYvaluesMultiTest()
        public virtual void NullYvaluesMultiTest()
        {
            double[] xValues = new double[] { 1.0, 2.0, 3.0, 4.0 };
//JAVA TO C# CONVERTER NOTE: The following call to the 'RectangularArrays' helper class reproduces the rectangular array initialization that is automatic in Java:
//ORIGINAL LINE: double[][] yValues = new double[2][4];
            double[][] yValues = RectangularArrays.ReturnRectangularDoubleArray(2, 4);

            yValues = null;

            NaturalSplineInterpolator interp = new NaturalSplineInterpolator();

            interp.interpolate(xValues, yValues);
        }
        ///
        public virtual void positivityEndIntervalsTest()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double[] xValues = new double[] {1.0, 2.0, 3.0, 4.0, 5.0, 6.0 };
            double[] xValues = new double[] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 };
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double[][] yValues = new double[][] { {0.01, 0.01, 0.01, 10.0, 20.0, 1.0 }, {0.01, 0.01, 10.0, 10.0, 0.01, 0.01 } };
            double[][] yValues = new double[][]
            {
                new double[] { 0.01, 0.01, 0.01, 10.0, 20.0, 1.0 },
                new double[] { 0.01, 0.01, 10.0, 10.0, 0.01, 0.01 }
            };

            PiecewisePolynomialInterpolator interp = new NaturalSplineInterpolator();
            PiecewisePolynomialResult       result = interp.interpolate(xValues, yValues);

            PiecewisePolynomialFunction1D function = new PiecewisePolynomialFunction1D();

            PiecewisePolynomialInterpolator interpPos = new NonnegativityPreservingCubicSplineInterpolator(interp);
            PiecewisePolynomialResult       resultPos = interpPos.interpolate(xValues, yValues);

            assertEquals(resultPos.Dimensions, result.Dimensions);
            assertEquals(resultPos.NumberOfIntervals, result.NumberOfIntervals);
            assertEquals(resultPos.Order, result.Order);

            const int nPts = 101;

            for (int i = 0; i < 101; ++i)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double key = 1.0 + 5.0 / (nPts - 1) * i;
                double key = 1.0 + 5.0 / (nPts - 1) * i;
                assertTrue(function.evaluate(resultPos, key).get(0) >= 0.0);
            }

            int dim   = yValues.Length;
            int nData = xValues.Length;

            for (int j = 0; j < dim; ++j)
            {
                for (int i = 1; i < nData - 2; ++i)
                {
                    DoubleMatrix coefMatrix = resultPos.CoefMatrix;
                    double       tau        = Math.Sign(coefMatrix.get(dim * i + j, 3));
                    assertTrue(coefMatrix.get(dim * i + j, 2) * tau >= -3.0 * yValues[j][i] * tau / (xValues[i + 1] - xValues[i]));
                    assertTrue(coefMatrix.get(dim * i + j, 2) * tau <= 3.0 * yValues[j][i] * tau / (xValues[i] - xValues[i - 1]));
                }
            }
        }
Пример #12
0
        ///
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void NullXvaluesMultiTest()
        public virtual void NullXvaluesMultiTest()
        {
            double[]   xValues = new double[4];
            double[][] yValues = new double[][]
            {
                new double[] { 1.0, 2.0, 3.0, 4.0 },
                new double[] { 1.0, 5.0, 3.0, 4.0 }
            };

            xValues = null;

            NaturalSplineInterpolator interp = new NaturalSplineInterpolator();

            interp.interpolate(xValues, yValues);
        }
Пример #13
0
        ///
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void LargeInterpolantsTest()
        public virtual void LargeInterpolantsTest()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double[] xValues = new double[] {1.0, 2.0, 3.0, 4.0 };
            double[] xValues = new double[] { 1.0, 2.0, 3.0, 4.0 };
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double[][] yValues = new double[][] { {2.0, 10.0, 2.0, 5.0 }, {1.0, 2.0, 10.0, 11.0 } };
            double[][] yValues = new double[][]
            {
                new double[] { 2.0, 10.0, 2.0, 5.0 },
                new double[] { 1.0, 2.0, 10.0, 11.0 }
            };

            NaturalSplineInterpolator interp = new NaturalSplineInterpolator();

            interp.interpolate(xValues, yValues[0], 1.e308);
        }
Пример #14
0
        /// <summary>
        /// Derive value of the underlying cubic spline function at the value of xKey
        /// </summary>
        public virtual void InterpolantsTest()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double[] xValues = new double[] {1.0, 2.0, 3.0, 4.0 };
            double[] xValues = new double[] { 1.0, 2.0, 3.0, 4.0 };
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double[][] yValues = new double[][] { {6.0, 25.0 / 6.0, 10.0 / 3.0, 4.0 }, {6.0, 1.0, 0.0, 0.0 } };
            double[][] yValues = new double[][]
            {
                new double[] { 6.0, 25.0 / 6.0, 10.0 / 3.0, 4.0 },
                new double[] { 6.0, 1.0, 0.0, 0.0 }
            };
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double[][] xKey = new double[][] { {-1.0, 0.5, 1.5 }, {2.5, 3.5, 4.5 } };
            double[][] xKey = new double[][]
            {
                new double[] { -1.0, 0.5, 1.5 },
                new double[] { 2.5, 3.5, 4.5 }
            };

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double[][][] resultValuesExpected = new double[][][] { { {26.0 / 3.0, 57.0 / 16.0 }, {10.0, 1.0 / 8.0 } }, { {335.0 / 48.0, 85.0 / 24.0 }, {71.0 / 8.0, 0.0 } }, { {241.0 / 48.0, 107.0 / 24.0 }, {25.0 / 8.0, 0.0 } } };
            double[][][] resultValuesExpected = new double[][][]
            {
                new double[][]
                {
                    new double[] { 26.0 / 3.0, 57.0 / 16.0 },
                    new double[] { 10.0, 1.0 / 8.0 }
                },
                new double[][]
                {
                    new double[] { 335.0 / 48.0, 85.0 / 24.0 },
                    new double[] { 71.0 / 8.0, 0.0 }
                },
                new double[][]
                {
                    new double[] { 241.0 / 48.0, 107.0 / 24.0 },
                    new double[] { 25.0 / 8.0, 0.0 }
                }
            };

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int yDim = yValues.length;
            int yDim = yValues.Length;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int keyLength = xKey[0].length;
            int keyLength = xKey[0].Length;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int keyDim = xKey.length;
            int keyDim = xKey.Length;

            PiecewisePolynomialInterpolator interp = new NaturalSplineInterpolator();

            double value = interp.interpolate(xValues, yValues[0], xKey[0][0]);
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double ref = resultValuesExpected[0][0][0] == 0.0 ? 1.0 : Math.abs(resultValuesExpected[0][0][0]);
                double @ref = resultValuesExpected[0][0][0] == 0.0 ? 1.0 : Math.Abs(resultValuesExpected[0][0][0]);
                assertEquals(value, resultValuesExpected[0][0][0], @ref * EPS);
            }

            DoubleArray valuesVec1 = interp.interpolate(xValues, yValues, xKey[0][0]);

            for (int i = 0; i < yDim; ++i)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double ref = resultValuesExpected[0][i][0] == 0.0 ? 1.0 : Math.abs(resultValuesExpected[0][i][0]);
                double @ref = resultValuesExpected[0][i][0] == 0.0 ? 1.0 : Math.Abs(resultValuesExpected[0][i][0]);
                assertEquals(valuesVec1.get(i), resultValuesExpected[0][i][0], @ref * EPS);
            }

            DoubleArray valuesVec2 = interp.interpolate(xValues, yValues[0], xKey[0]);

            for (int k = 0; k < keyLength; ++k)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double ref = resultValuesExpected[k][0][0] == 0.0 ? 1.0 : Math.abs(resultValuesExpected[k][0][0]);
                double @ref = resultValuesExpected[k][0][0] == 0.0 ? 1.0 : Math.Abs(resultValuesExpected[k][0][0]);
                assertEquals(valuesVec2.get(k), resultValuesExpected[k][0][0], @ref * EPS);
            }

            DoubleMatrix valuesMat1 = interp.interpolate(xValues, yValues[0], xKey);

            for (int j = 0; j < keyDim; ++j)
            {
                for (int k = 0; k < keyLength; ++k)
                {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double ref = resultValuesExpected[k][0][j] == 0.0 ? 1.0 : Math.abs(resultValuesExpected[k][0][j]);
                    double @ref = resultValuesExpected[k][0][j] == 0.0 ? 1.0 : Math.Abs(resultValuesExpected[k][0][j]);
                    assertEquals(valuesMat1.get(j, k), resultValuesExpected[k][0][j], @ref * EPS);
                }
            }

            DoubleMatrix valuesMat2 = interp.interpolate(xValues, yValues, xKey[0]);

            for (int i = 0; i < yDim; ++i)
            {
                for (int k = 0; k < keyLength; ++k)
                {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double ref = resultValuesExpected[k][i][0] == 0.0 ? 1.0 : Math.abs(resultValuesExpected[k][i][0]);
                    double @ref = resultValuesExpected[k][i][0] == 0.0 ? 1.0 : Math.Abs(resultValuesExpected[k][i][0]);
                    assertEquals(valuesMat2.get(i, k), resultValuesExpected[k][i][0], @ref * EPS);
                }
            }

            DoubleMatrix[] valuesMat3 = interp.interpolate(xValues, yValues, xKey);
            for (int i = 0; i < yDim; ++i)
            {
                for (int j = 0; j < keyDim; ++j)
                {
                    for (int k = 0; k < keyLength; ++k)
                    {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double ref = resultValuesExpected[k][i][j] == 0.0 ? 1.0 : Math.abs(resultValuesExpected[k][i][j]);
                        double @ref = resultValuesExpected[k][i][j] == 0.0 ? 1.0 : Math.Abs(resultValuesExpected[k][i][j]);
                        assertEquals(valuesMat3[k].get(i, j), resultValuesExpected[k][i][j], @ref * EPS);
                    }
                }
            }
        }
        ///
        public virtual void crossDerivativeTest()
        {
            double[] x0Values = new double[] { 1.0, 2.0, 3.0, 4.0 };
            double[] x1Values = new double[] { -1.0, 0.0, 1.0, 2.0, 3.0 };
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int n0Data = x0Values.length;
            int n0Data = x0Values.Length;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int n1Data = x1Values.length;
            int n1Data = x1Values.Length;

            double[][] yValues = new double[][]
            {
                new double[] { 1.0, -1.0, 0.0, 1.0, 0.0 },
                new double[] { 1.0, -1.0, 0.0, 1.0, -2.0 },
                new double[] { 1.0, -2.0, 0.0, -2.0, -2.0 },
                new double[] { -1.0, -1.0, -2.0, -2.0, -1.0 }
            };

            NaturalSplineInterpolator         method = new NaturalSplineInterpolator();
            PiecewisePolynomialInterpolator2D interp = new BicubicSplineInterpolator(method);
            PiecewisePolynomialResult2D       result = interp.interpolate(x0Values, x1Values, yValues);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int n0IntExp = n0Data - 1;
            int n0IntExp = n0Data - 1;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int n1IntExp = n1Data - 1;
            int       n1IntExp = n1Data - 1;
            const int orderExp = 4;

            const int n0Keys = 51;
            const int n1Keys = 61;

            double[] x0Keys = new double[n0Keys];
            double[] x1Keys = new double[n1Keys];
            for (int i = 0; i < n0Keys; ++i)
            {
                x0Keys[i] = 0.0 + 5.0 * i / (n0Keys - 1);
            }
            for (int i = 0; i < n1Keys; ++i)
            {
                x1Keys[i] = -2.0 + 6.0 * i / (n1Keys - 1);
            }

            assertEquals(result.NumberOfIntervals[0], n0IntExp);
            assertEquals(result.NumberOfIntervals[1], n1IntExp);
            assertEquals(result.Order[0], orderExp);
            assertEquals(result.Order[1], orderExp);

            for (int i = 0; i < n0Data; ++i)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double ref = Math.abs(x0Values[i]) == 0.0 ? 1.0 : Math.abs(x0Values[i]);
                double @ref = Math.Abs(x0Values[i]) == 0.0 ? 1.0 : Math.Abs(x0Values[i]);
                assertEquals(result.Knots0.get(i), x0Values[i], @ref * EPS);
                assertEquals(result.Knots2D[0].get(i), x0Values[i], @ref * EPS);
            }
            for (int i = 0; i < n1Data; ++i)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double ref = Math.abs(x1Values[i]) == 0.0 ? 1.0 : Math.abs(x1Values[i]);
                double @ref = Math.Abs(x1Values[i]) == 0.0 ? 1.0 : Math.Abs(x1Values[i]);
                assertEquals(result.Knots1.get(i), x1Values[i], @ref * EPS);
                assertEquals(result.Knots2D[1].get(i), x1Values[i], @ref * EPS);
            }

            for (int i = 0; i < n0Data - 1; ++i)
            {
                for (int j = 0; j < n1Data - 1; ++j)
                {
                    double @ref = Math.Abs(yValues[i][j]) == 0.0 ? 1.0 : Math.Abs(yValues[i][j]);
                    assertEquals(result.Coefs[i][j].get(orderExp - 1, orderExp - 1), yValues[i][j], @ref * EPS);
                }
            }

            DoubleMatrix resValues = interp.interpolate(x0Values, x1Values, yValues, x0Values, x1Values);
            PiecewisePolynomialFunction2D func2D = new PiecewisePolynomialFunction2D();
            DoubleMatrix resDiffX0 = func2D.differentiateX0(result, x0Values, x1Values);
            DoubleMatrix resDiffX1 = func2D.differentiateX1(result, x0Values, x1Values);

            PiecewisePolynomialFunction1D func1D = new PiecewisePolynomialFunction1D();
            DoubleMatrix expDiffX0 = func1D.differentiate(method.interpolate(x0Values, OG_ALGEBRA.getTranspose(DoubleMatrix.copyOf(yValues)).toArray()), x0Values);
            DoubleMatrix expDiffX1 = func1D.differentiate(method.interpolate(x1Values, yValues), x1Values);

            for (int i = 0; i < n0Data; ++i)
            {
                for (int j = 0; j < n1Data; ++j)
                {
                    double expVal = expDiffX1.get(i, j);
                    double @ref   = Math.Abs(expVal) == 0.0 ? 1.0 : Math.Abs(expVal);
                    assertEquals(resDiffX1.get(i, j), expVal, @ref * EPS);
                }
            }

            for (int i = 0; i < n0Data; ++i)
            {
                for (int j = 0; j < n1Data; ++j)
                {
                    double expVal = expDiffX0.get(j, i);
                    double @ref   = Math.Abs(expVal) == 0.0 ? 1.0 : Math.Abs(expVal);
                    assertEquals(resDiffX0.get(i, j), expVal, @ref * EPS);
                }
            }

            for (int i = 0; i < n0Data; ++i)
            {
                for (int j = 0; j < n1Data; ++j)
                {
                    double expVal = yValues[i][j];
                    double @ref   = Math.Abs(expVal) == 0.0 ? 1.0 : Math.Abs(expVal);
                    assertEquals(resValues.get(i, j), expVal, @ref * EPS);
                }
            }
        }