/// //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void nanYdataTest() public virtual void nanYdataTest() { double[] xValues = new double[] { 1.0, 2.0, 3.0, 4.0 }; double[] yValues = new double[] { 0.0, 0.0, 0.1, 0.05, 0.2, Double.NaN }; PiecewisePolynomialInterpolator interp = new CubicSplineInterpolator(); PiecewisePolynomialInterpolator interpPos = new NonnegativityPreservingCubicSplineInterpolator(interp); interpPos.interpolate(xValues, yValues); }
/// //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void infXdataMultiTest() public virtual void infXdataMultiTest() { double[] xValues = new double[] { 1.0, 2.0, 3.0, INF }; double[][] yValues = new double[][] { new double[] { 0.0, 0.1, 0.05, 0.2 }, new double[] { 0.0, 0.1, 0.05, 0.2 } }; PiecewisePolynomialInterpolator interp = new CubicSplineInterpolator(); PiecewisePolynomialInterpolator interpPos = new NonnegativityPreservingCubicSplineInterpolator(interp); interpPos.interpolate(xValues, yValues); }
/// //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void diffDataTest() public virtual void diffDataTest() { //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[] {0.0, 0.1, 0.05 }; double[] yValues = new double[] { 0.0, 0.1, 0.05 }; PiecewisePolynomialInterpolator interp = new NaturalSplineInterpolator(); PiecewisePolynomialInterpolator interpPos = new NonnegativityPreservingCubicSplineInterpolator(interp); interpPos.interpolate(xValues, yValues); }
/// public virtual void positivityClampedMultiTest() { //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 }; double[] xValues = new double[] { 1.0, 2.0, 3.0, 4.0, 5.0 }; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final double[][] yValues = new double[][] { {0.0, 0.1, 1.0, 1.0, 20.0, 5.0, 0.0 }, {-10.0, 0.1, 1.0, 1.0, 20.0, 5.0, 0.0 } }; double[][] yValues = new double[][] { new double[] { 0.0, 0.1, 1.0, 1.0, 20.0, 5.0, 0.0 }, new double[] { -10.0, 0.1, 1.0, 1.0, 20.0, 5.0, 0.0 } }; PiecewisePolynomialInterpolator interp = new CubicSplineInterpolator(); 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 + 4.0 / (nPts - 1) * i; double key = 1.0 + 4.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 + 1] * tau / (xValues[i + 1] - xValues[i])); assertTrue(coefMatrix.get(dim * i + j, 2) * tau <= 3.0 * yValues[j][i + 1] * tau / (xValues[i] - xValues[i - 1])); } } }
/// //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void coincideDataMultiTest() public virtual void coincideDataMultiTest() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final double[] xValues = new double[] {1.0, 2.0, 2.0 }; double[] xValues = new double[] { 1.0, 2.0, 2.0 }; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final double[][] yValues = new double[][] { {2.0, 0.0, 0.1, 0.05, 2.0 }, {1.0, 0.0, 0.1, 1.05, 2.0 } }; double[][] yValues = new double[][] { new double[] { 2.0, 0.0, 0.1, 0.05, 2.0 }, new double[] { 1.0, 0.0, 0.1, 1.05, 2.0 } }; PiecewisePolynomialInterpolator interp = new CubicSplineInterpolator(); PiecewisePolynomialInterpolator interpPos = new NonnegativityPreservingCubicSplineInterpolator(interp); interpPos.interpolate(xValues, yValues); }
/// public virtual void flipMultiTest() { //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[][] { {3.0, 0.1, 0.01, 0.01, 0.1, 3.0 }, {3.0, 0.1, 0.01, 0.001, 2.0, 3.0 } }; double[][] yValues = new double[][] { new double[] { 3.0, 0.1, 0.01, 0.01, 0.1, 3.0 }, new double[] { 3.0, 0.1, 0.01, 0.001, 2.0, 3.0 } }; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final double[] xValuesFlip = new double[] {1.0, 2.0, 3.0, 5.0, 4.0, 6.0 }; double[] xValuesFlip = new double[] { 1.0, 2.0, 3.0, 5.0, 4.0, 6.0 }; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final double[][] yValuesFlip = new double[][] { {3.0, 0.1, 0.01, 0.1, 0.01, 3.0 }, {3.0, 0.1, 0.01, 2.0, 0.001, 3.0 } }; double[][] yValuesFlip = new double[][] { new double[] { 3.0, 0.1, 0.01, 0.1, 0.01, 3.0 }, new double[] { 3.0, 0.1, 0.01, 2.0, 0.001, 3.0 } }; PiecewisePolynomialInterpolator interp = new NaturalSplineInterpolator(); PiecewisePolynomialFunction1D function = new PiecewisePolynomialFunction1D(); PiecewisePolynomialInterpolator interpPos = new NonnegativityPreservingCubicSplineInterpolator(interp); PiecewisePolynomialResult resultPos = interpPos.interpolate(xValues, yValues); PiecewisePolynomialResult resultPosFlip = interpPos.interpolate(xValuesFlip, yValuesFlip); assertEquals(resultPos.Dimensions, resultPosFlip.Dimensions); assertEquals(resultPos.NumberOfIntervals, resultPosFlip.NumberOfIntervals); assertEquals(resultPos.Order, resultPosFlip.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); assertTrue(function.evaluate(resultPos, key).get(1) >= 0.0); } int dim = yValues.Length; int nData = xValues.Length; for (int j = 0; j < dim; ++j) { for (int i = 0; i < nData - 1; ++i) { for (int k = 0; k < 4; ++k) { assertEquals(resultPos.CoefMatrix.get(dim * i + j, k), resultPosFlip.CoefMatrix.get(dim * i + j, k)); } } } }