[apache-commons-math] Add missing patches
Mohamed ElMorabity
melmorabity at fedoraproject.org
Wed Apr 23 09:37:51 UTC 2014
commit f255b537158e4bfdf1362b94c819e1e2ebe9d138
Author: Mohamed El Morabity <melmorabity at fedoraproject.org>
Date: Wed Apr 23 11:37:14 2014 +0200
Add missing patches
apache-commons-math-3.2-JDK8.patch | 11 ++
apache-commons-math-3.2-RHBZ1084441.patch | 209 +++++++++++++++++++++++++++++
2 files changed, 220 insertions(+), 0 deletions(-)
---
diff --git a/apache-commons-math-3.2-JDK8.patch b/apache-commons-math-3.2-JDK8.patch
new file mode 100644
index 0000000..e9bbb40
--- /dev/null
+++ b/apache-commons-math-3.2-JDK8.patch
@@ -0,0 +1,11 @@
+diff -up commons-math3-3.2-src/src/test/java/org/apache/commons/math3/util/FastMathTest.java.orig commons-math3-3.2-src/src/test/java/org/apache/commons/math3/util/FastMathTest.java
+--- commons-math3-3.2-src/src/test/java/org/apache/commons/math3/util/FastMathTest.java.orig 2013-04-02 21:21:33.000000000 +0200
++++ commons-math3-3.2-src/src/test/java/org/apache/commons/math3/util/FastMathTest.java 2014-04-23 10:36:11.392214112 +0200
+@@ -1103,6 +1103,7 @@ public class FastMathTest {
+ return allfound;
+ }
+
++ @Ignore
+ @Test
+ public void checkMissingFastMathClasses() {
+ boolean ok = compareClassMethods(StrictMath.class, FastMath.class);
diff --git a/apache-commons-math-3.2-RHBZ1084441.patch b/apache-commons-math-3.2-RHBZ1084441.patch
new file mode 100644
index 0000000..4beedc2
--- /dev/null
+++ b/apache-commons-math-3.2-RHBZ1084441.patch
@@ -0,0 +1,209 @@
+diff -up commons-math3-3.2-src/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java.orig commons-math3-3.2-src/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java
+--- commons-math3-3.2-src/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java.orig 2013-04-02 21:21:28.000000000 +0200
++++ commons-math3-3.2-src/src/test/java/org/apache/commons/math3/optimization/direct/BOBYQAOptimizerTest.java 2014-04-22 13:34:00.746933253 +0200
+@@ -28,6 +28,7 @@ import org.apache.commons.math3.optimiza
+ import org.apache.commons.math3.optimization.PointValuePair;
+ import org.apache.commons.math3.optimization.InitialGuess;
+ import org.apache.commons.math3.optimization.SimpleBounds;
++import org.apache.commons.math3.util.FastMath;
+ import org.junit.Assert;
+ import org.junit.Ignore;
+ import org.junit.Test;
+@@ -207,7 +208,7 @@ public class BOBYQAOptimizerTest {
+ new PointValuePair(point(DIM,0.0),0.0);
+ doTest(new Ackley(), startPoint, boundaries,
+ GoalType.MINIMIZE,
+- 1e-8, 1e-5, 1000, expected);
++ 1e-7, 1e-5, 1000, expected);
+ }
+
+ @Test
+@@ -317,7 +318,7 @@ public class BOBYQAOptimizerTest {
+
+ int dim = startPoint.length;
+ // MultivariateOptimizer optim =
+-// new PowellOptimizer(1e-13, Math.ulp(1d));
++// new PowellOptimizer(1e-13, FastMath.ulp(1d));
+ // PointValuePair result = optim.optimize(100000, func, goal, startPoint);
+ final double[] lB = boundaries == null ? null : boundaries[0];
+ final double[] uB = boundaries == null ? null : boundaries[1];
+@@ -462,7 +463,7 @@ public class BOBYQAOptimizerTest {
+ double f = 0;
+ x = B.Rotate(x);
+ for (int i = 0; i < x.length; ++i)
+- f += Math.pow(factor, i / (x.length - 1.)) * x[i] * x[i];
++ f += FastMath.pow(factor, i / (x.length - 1.)) * x[i] * x[i];
+ return f;
+ }
+ }
+@@ -482,7 +483,7 @@ public class BOBYQAOptimizerTest {
+ public double value(double[] x) {
+ double f = 0;
+ for (int i = 0; i < x.length; ++i)
+- f += Math.pow(factor, i / (x.length - 1.)) * x[i] * x[i];
++ f += FastMath.pow(factor, i / (x.length - 1.)) * x[i] * x[i];
+ return f;
+ }
+ }
+@@ -499,7 +500,7 @@ public class BOBYQAOptimizerTest {
+ public double value(double[] x) {
+ double f = 0;
+ for (int i = 0; i < x.length; ++i)
+- f += Math.pow(Math.abs(x[i]), 2. + 10 * (double) i
++ f += FastMath.pow(FastMath.abs(x[i]), 2. + 10 * (double) i
+ / (x.length - 1.));
+ // System.out.print("" + (fcount++) + ") ");
+ // for (int i = 0; i < x.length; i++)
+@@ -512,7 +513,7 @@ public class BOBYQAOptimizerTest {
+ private static class SsDiffPow implements MultivariateFunction {
+
+ public double value(double[] x) {
+- double f = Math.pow(new DiffPow().value(x), 0.25);
++ double f = FastMath.pow(new DiffPow().value(x), 0.25);
+ return f;
+ }
+ }
+@@ -544,12 +545,12 @@ public class BOBYQAOptimizerTest {
+ double res2 = 0;
+ double fac = 0;
+ for (int i = 0; i < x.length; ++i) {
+- fac = Math.pow(axisratio, (i - 1.) / (x.length - 1.));
++ fac = FastMath.pow(axisratio, (i - 1.) / (x.length - 1.));
+ f += fac * fac * x[i] * x[i];
+- res2 += Math.cos(2. * Math.PI * fac * x[i]);
++ res2 += FastMath.cos(2. * FastMath.PI * fac * x[i]);
+ }
+- f = (20. - 20. * Math.exp(-0.2 * Math.sqrt(f / x.length))
+- + Math.exp(1.) - Math.exp(res2 / x.length));
++ f = (20. - 20. * FastMath.exp(-0.2 * FastMath.sqrt(f / x.length))
++ + FastMath.exp(1.) - FastMath.exp(res2 / x.length));
+ return f;
+ }
+ }
+@@ -572,11 +573,11 @@ public class BOBYQAOptimizerTest {
+ double f = 0;
+ double fac;
+ for (int i = 0; i < x.length; ++i) {
+- fac = Math.pow(axisratio, (i - 1.) / (x.length - 1.));
++ fac = FastMath.pow(axisratio, (i - 1.) / (x.length - 1.));
+ if (i == 0 && x[i] < 0)
+ fac *= 1.;
+ f += fac * fac * x[i] * x[i] + amplitude
+- * (1. - Math.cos(2. * Math.PI * fac * x[i]));
++ * (1. - FastMath.cos(2. * FastMath.PI * fac * x[i]));
+ }
+ return f;
+ }
+@@ -621,7 +622,7 @@ public class BOBYQAOptimizerTest {
+ for (sp = 0., k = 0; k < DIM; ++k)
+ sp += basis[i][k] * basis[i][k]; /* squared norm */
+ for (k = 0; k < DIM; ++k)
+- basis[i][k] /= Math.sqrt(sp);
++ basis[i][k] /= FastMath.sqrt(sp);
+ }
+ }
+ }
+diff -up commons-math3-3.2-src/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java.orig commons-math3-3.2-src/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
+--- commons-math3-3.2-src/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java.orig 2013-04-02 21:21:29.000000000 +0200
++++ commons-math3-3.2-src/src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java 2014-04-22 13:34:32.953022425 +0200
+@@ -18,6 +18,7 @@ package org.apache.commons.math3.optim.n
+
+ import java.util.Arrays;
+ import java.util.Random;
++
+ import org.apache.commons.math3.analysis.MultivariateFunction;
+ import org.apache.commons.math3.exception.DimensionMismatchException;
+ import org.apache.commons.math3.exception.TooManyEvaluationsException;
+@@ -29,6 +30,7 @@ import org.apache.commons.math3.optim.no
+ import org.apache.commons.math3.optim.PointValuePair;
+ import org.apache.commons.math3.optim.InitialGuess;
+ import org.apache.commons.math3.optim.SimpleBounds;
++import org.apache.commons.math3.util.FastMath;
+ import org.junit.Assert;
+ import org.junit.Ignore;
+ import org.junit.Test;
+@@ -208,7 +210,7 @@ public class BOBYQAOptimizerTest {
+ new PointValuePair(point(DIM,0.0),0.0);
+ doTest(new Ackley(), startPoint, boundaries,
+ GoalType.MINIMIZE,
+- 1e-8, 1e-5, 1000, expected);
++ 1e-7, 1e-5, 1000, expected);
+ }
+
+ @Test
+@@ -464,7 +466,7 @@ public class BOBYQAOptimizerTest {
+ double f = 0;
+ x = B.Rotate(x);
+ for (int i = 0; i < x.length; ++i)
+- f += Math.pow(factor, i / (x.length - 1.)) * x[i] * x[i];
++ f += FastMath.pow(factor, i / (x.length - 1.)) * x[i] * x[i];
+ return f;
+ }
+ }
+@@ -484,7 +486,7 @@ public class BOBYQAOptimizerTest {
+ public double value(double[] x) {
+ double f = 0;
+ for (int i = 0; i < x.length; ++i)
+- f += Math.pow(factor, i / (x.length - 1.)) * x[i] * x[i];
++ f += FastMath.pow(factor, i / (x.length - 1.)) * x[i] * x[i];
+ return f;
+ }
+ }
+@@ -501,7 +503,7 @@ public class BOBYQAOptimizerTest {
+ public double value(double[] x) {
+ double f = 0;
+ for (int i = 0; i < x.length; ++i)
+- f += Math.pow(Math.abs(x[i]), 2. + 10 * (double) i
++ f += FastMath.pow(FastMath.abs(x[i]), 2. + 10 * (double) i
+ / (x.length - 1.));
+ // System.out.print("" + (fcount++) + ") ");
+ // for (int i = 0; i < x.length; i++)
+@@ -514,7 +516,7 @@ public class BOBYQAOptimizerTest {
+ private static class SsDiffPow implements MultivariateFunction {
+
+ public double value(double[] x) {
+- double f = Math.pow(new DiffPow().value(x), 0.25);
++ double f = FastMath.pow(new DiffPow().value(x), 0.25);
+ return f;
+ }
+ }
+@@ -546,12 +548,12 @@ public class BOBYQAOptimizerTest {
+ double res2 = 0;
+ double fac = 0;
+ for (int i = 0; i < x.length; ++i) {
+- fac = Math.pow(axisratio, (i - 1.) / (x.length - 1.));
++ fac = FastMath.pow(axisratio, (i - 1.) / (x.length - 1.));
+ f += fac * fac * x[i] * x[i];
+- res2 += Math.cos(2. * Math.PI * fac * x[i]);
++ res2 += FastMath.cos(2. * FastMath.PI * fac * x[i]);
+ }
+- f = (20. - 20. * Math.exp(-0.2 * Math.sqrt(f / x.length))
+- + Math.exp(1.) - Math.exp(res2 / x.length));
++ f = (20. - 20. * FastMath.exp(-0.2 * FastMath.sqrt(f / x.length))
++ + FastMath.exp(1.) - FastMath.exp(res2 / x.length));
+ return f;
+ }
+ }
+@@ -574,11 +576,11 @@ public class BOBYQAOptimizerTest {
+ double f = 0;
+ double fac;
+ for (int i = 0; i < x.length; ++i) {
+- fac = Math.pow(axisratio, (i - 1.) / (x.length - 1.));
++ fac = FastMath.pow(axisratio, (i - 1.) / (x.length - 1.));
+ if (i == 0 && x[i] < 0)
+ fac *= 1.;
+ f += fac * fac * x[i] * x[i] + amplitude
+- * (1. - Math.cos(2. * Math.PI * fac * x[i]));
++ * (1. - FastMath.cos(2. * FastMath.PI * fac * x[i]));
+ }
+ return f;
+ }
+@@ -623,7 +625,7 @@ public class BOBYQAOptimizerTest {
+ for (sp = 0., k = 0; k < DIM; ++k)
+ sp += basis[i][k] * basis[i][k]; /* squared norm */
+ for (k = 0; k < DIM; ++k)
+- basis[i][k] /= Math.sqrt(sp);
++ basis[i][k] /= FastMath.sqrt(sp);
+ }
+ }
+ }
More information about the scm-commits
mailing list