You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2021/12/01 01:37:31 UTC
[commons-math] 02/03: MATH-1635: Unit test demonstrating the reported issue.
This is an automated email from the ASF dual-hosted git repository.
erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git
commit c6094cf9e0f99f71e92e678fef08202fe3301069
Author: Gilles Sadowski <gi...@gmail.com>
AuthorDate: Wed Dec 1 02:27:51 2021 +0100
MATH-1635: Unit test demonstrating the reported issue.
Test is set to "@Ignore" since the behaviour may be a known limitation.
---
.../interpolation/AkimaSplineInterpolatorTest.java | 31 ++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/analysis/interpolation/AkimaSplineInterpolatorTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/analysis/interpolation/AkimaSplineInterpolatorTest.java
index c59a9bd..aea67a9 100644
--- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/analysis/interpolation/AkimaSplineInterpolatorTest.java
+++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/analysis/interpolation/AkimaSplineInterpolatorTest.java
@@ -26,12 +26,14 @@ import org.apache.commons.math4.legacy.exception.DimensionMismatchException;
import org.apache.commons.math4.legacy.exception.NonMonotonicSequenceException;
import org.apache.commons.math4.legacy.exception.NullArgumentException;
import org.apache.commons.math4.legacy.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.legacy.analysis.polynomials.PolynomialSplineFunction;
import org.apache.commons.rng.UniformRandomProvider;
import org.apache.commons.rng.simple.RandomSource;
import org.apache.commons.math4.core.jdkmath.JdkMath;
import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.Ignore;
public class AkimaSplineInterpolatorTest {
@Test
@@ -160,6 +162,35 @@ public class AkimaSplineInterpolatorTest {
maxTolerance );
}
+ // Test currently fails but it is not clear whether
+ // https://issues.apache.org/jira/browse/MATH-1635
+ // actually describes a bug, or a limitation of the algorithm.
+ @Ignore
+ @Test
+ public void testMath1635() {
+ final double[] x = {
+ 5994, 6005, 6555, 6588, 6663,
+ 6760, 6770, 6792, 6856, 6964,
+ 7028, 7233, 7426, 7469, 7619,
+ 7910, 8038, 8178, 8414, 8747,
+ 8983, 9316, 9864, 9875
+ };
+
+ final double[] y = {
+ 3.0, 2.0, 2.0, 2.0, 2.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0,
+ 2.0, 2.0, 2.0, 2.0, 2.0,
+ 2.0, 2.0, 2.0, 3.0
+ };
+
+ final AkimaSplineInterpolator interpolator = new AkimaSplineInterpolator(true);
+ final PolynomialSplineFunction interpolate = interpolator.interpolate(x, y);
+ final double value = interpolate.value(9584);
+ final double expected = 2;
+ Assert.assertEquals(expected, value, 1e-4);
+ }
+
@Test
public void testOriginalVsModified() {
final UnivariateFunction f = new UnivariateFunction() {