[commons-math] Git Push Summary

2016-01-17 Thread luc
Repository: commons-math
Updated Branches:
  refs/heads/random-revamp [deleted] e76bf903a


[commons-math] Git Push Summary

2016-01-17 Thread luc
Repository: commons-math
Updated Branches:
  refs/heads/random-revamp [created] e76bf903a


[01/22] [math] Reverting commit 4cbb388ba9099be121f81d75000acc3af93bf993 as per Gilles request.

2016-01-17 Thread luc
Repository: commons-math
Updated Branches:
  refs/heads/master 4742149a8 -> 9d4fb4952


Reverting commit 4cbb388ba9099be121f81d75000acc3af93bf993 as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/9d4fb495
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/9d4fb495
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/9d4fb495

Branch: refs/heads/master
Commit: 9d4fb495265055724c2dfc2efa05460ee36fc2cf
Parents: 3c2fede
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:35:25 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../math4/random/BaseRandomGenerator.java   | 270 ---
 .../math4/random/BaseRandomGeneratorTest.java   | 129 -
 2 files changed, 399 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/9d4fb495/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java 
b/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
deleted file mode 100644
index a78fd38..000
--- a/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.random;
-
-import java.io.Serializable;
-
-import org.apache.commons.math4.exception.NotStrictlyPositiveException;
-import org.apache.commons.math4.exception.OutOfRangeException;
-import org.apache.commons.math4.util.FastMath;
-
-/**
- * Abstract class implementing the methods of the {@link RandomGenerator}
- * interface in a generic way on the basis of abstract method {@link nextInt()}
- * to be defined in subclasses.
- *
- * It also provides additional utility methods that are not part of the
- * {@link RandomGenerator} API.
- *
- * @since 4.0
- */
-public abstract class BaseRandomGenerator
-implements RandomGenerator,
-   Serializable {
-/** Identifier for serialization. */
-private static final long serialVersionUID = 20151227L;
-/** Next Gaussian. */
-private double nextGaussian = Double.NaN;
-
-/**
- * {@inheritDoc}
- *
- * Basic building block for all the generic methods defined in this class.
- * It produces the next random number according to a specific algorithm to
- * be implemented by a subclass.
- */
-@Override
-public abstract int nextInt();
-
-/** {@inheritDoc} */
-@Override
-public boolean nextBoolean() {
-return (nextInt() >>> 31) != 0;
-}
-
-/** {@inheritDoc} */
-@Override
-public double nextDouble() {
-final long high = ((long) (nextInt() >>> 6)) << 26;
-final int low  = nextInt() >>> 6;
-return (high | low) * 0x1.0p-52d;
-}
-
-/** {@inheritDoc} */
-@Override
-public float nextFloat() {
-return (nextInt() >>> 9) * 0x1.0p-23f;
-}
-
-/** {@inheritDoc} */
-@Override
-public double nextGaussian() {
-final double random;
-if (Double.isNaN(nextGaussian)) {
-// Generate a new pair of gaussian numbers.
-final double x = nextDouble();
-final double y = nextDouble();
-final double alpha = 2 * FastMath.PI * x;
-final double r = FastMath.sqrt(-2 * FastMath.log(y));
-random = r * FastMath.cos(alpha);
-nextGaussian = r * FastMath.sin(alpha);
-} else {
-// Use the second element of the pair already generated.
-random = nextGaussian;
-nextGaussian = Double.NaN;
-}
-
-return random;
-}
-
-/**
- * {@inheritDoc}
- *
- * 
- * This 

[22/22] [math] Reverting commit 87497c72460c9c58f829a372d741b386fc2ac8f8 as per Gilles request.

2016-01-17 Thread luc
Reverting commit 87497c72460c9c58f829a372d741b386fc2ac8f8 as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/17bc99fd
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/17bc99fd
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/17bc99fd

Branch: refs/heads/master
Commit: 17bc99fdff3e8863be845211e2af050e8c9f98f7
Parents: aaf4027
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:35:25 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../commons/math4/random/MersenneTwister.java   | 16 
 .../commons/math4/random/MersenneTwisterTest.java   |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/17bc99fd/src/main/java/org/apache/commons/math4/random/MersenneTwister.java
--
diff --git a/src/main/java/org/apache/commons/math4/random/MersenneTwister.java 
b/src/main/java/org/apache/commons/math4/random/MersenneTwister.java
index d8caaa7..c84ff8c 100644
--- a/src/main/java/org/apache/commons/math4/random/MersenneTwister.java
+++ b/src/main/java/org/apache/commons/math4/random/MersenneTwister.java
@@ -83,12 +83,10 @@ import org.apache.commons.math4.util.FastMath;
  * @since 2.0
 
  */
-public class MersenneTwister
-extends BaseRandomGenerator
-implements Serializable {
+public class MersenneTwister extends BitsStreamGenerator implements 
Serializable {
 
 /** Serializable version identifier. */
-private static final long serialVersionUID = 20151228L;
+private static final long serialVersionUID = 8661194735290153518L;
 
 /** Size of the bytes pool. */
 private static final int   N = 624;
@@ -226,13 +224,13 @@ public class MersenneTwister
  * This method is the core generation algorithm. It is used by all the
  * public generation methods for the various primitive types {@link
  * #nextBoolean()}, {@link #nextBytes(byte[])}, {@link #nextDouble()},
- * {@link #nextFloat()}, {@link #nextGaussian()} and {@link #nextLong()}.
- * 
+ * {@link #nextFloat()}, {@link #nextGaussian()}, {@link #nextInt()},
+ * {@link #next(int)} and {@link #nextLong()}.
  * @param bits number of random bits to produce
  * @return random bits generated
  */
 @Override
-public int nextInt() {
+protected int next(int bits) {
 
 int y;
 
@@ -264,6 +262,8 @@ public class MersenneTwister
 y ^= (y <<  15) & 0xefc6;
 y ^=  y >>> 18;
 
-return y;
+return y >>> (32 - bits);
+
 }
+
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/17bc99fd/src/test/java/org/apache/commons/math4/random/MersenneTwisterTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/random/MersenneTwisterTest.java 
b/src/test/java/org/apache/commons/math4/random/MersenneTwisterTest.java
index 7c55d6a..1446003 100644
--- a/src/test/java/org/apache/commons/math4/random/MersenneTwisterTest.java
+++ b/src/test/java/org/apache/commons/math4/random/MersenneTwisterTest.java
@@ -21,7 +21,7 @@ import org.apache.commons.math4.random.RandomGenerator;
 import org.junit.Assert;
 import org.junit.Test;
 
-public class MersenneTwisterTest extends BaseRandomGeneratorTest {
+public class MersenneTwisterTest extends RandomGeneratorAbstractTest {
 
 @Override
 protected RandomGenerator makeGenerator() {



[18/22] [math] Reverting commit ffae3bdbb6740e336a223a82a3dd545c24cde7b5 as per Gilles request.

2016-01-17 Thread luc
Reverting commit ffae3bdbb6740e336a223a82a3dd545c24cde7b5 as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/df46ed5e
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/df46ed5e
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/df46ed5e

Branch: refs/heads/master
Commit: df46ed5edde4aea856cb16b8bc4ab791fef206ef
Parents: 7c31eb6
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:35:25 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../commons/math4/random/AbstractWell.java  | 10 +
 .../apache/commons/math4/random/Well1024a.java  | 22 ++--
 .../apache/commons/math4/random/Well19937a.java |  6 --
 .../apache/commons/math4/random/Well19937c.java |  6 --
 .../apache/commons/math4/random/Well44497a.java |  6 --
 .../apache/commons/math4/random/Well44497b.java |  6 --
 .../apache/commons/math4/random/Well512a.java   |  6 --
 .../commons/math4/random/Well1024aTest.java |  2 +-
 .../commons/math4/random/Well19937aTest.java|  2 +-
 .../commons/math4/random/Well19937cTest.java|  2 +-
 .../commons/math4/random/Well44497aTest.java|  2 +-
 .../commons/math4/random/Well44497bTest.java|  2 +-
 .../commons/math4/random/Well512aTest.java  |  2 +-
 13 files changed, 43 insertions(+), 31 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/df46ed5e/src/main/java/org/apache/commons/math4/random/AbstractWell.java
--
diff --git a/src/main/java/org/apache/commons/math4/random/AbstractWell.java 
b/src/main/java/org/apache/commons/math4/random/AbstractWell.java
index da222fd..7251bcd 100644
--- a/src/main/java/org/apache/commons/math4/random/AbstractWell.java
+++ b/src/main/java/org/apache/commons/math4/random/AbstractWell.java
@@ -34,12 +34,10 @@ import org.apache.commons.math4.util.FastMath;
  * @see http://www.iro.umontreal.ca/~panneton/WELLRNG.html;>WELL 
Random number generator
  * @since 2.2
  */
-public abstract class AbstractWell
-extends BaseRandomGenerator
-implements Serializable {
+public abstract class AbstractWell extends BitsStreamGenerator implements 
Serializable {
 
 /** Serializable version identifier. */
-private static final long serialVersionUID = 20150228L;
+private static final long serialVersionUID = 20150223L;
 
 /** Current index in the bytes pool. */
 protected int index;
@@ -135,6 +133,10 @@ public abstract class AbstractWell
 setSeed(new int[] { (int) (seed >>> 32), (int) (seed & 0xl) });
 }
 
+/** {@inheritDoc} */
+@Override
+protected abstract int next(final int bits);
+
 /** Calculate the number of 32-bits blocks.
  * @param k number of bits in the pool (not necessarily a multiple of 32)
  * @return the number of 32-bits blocks

http://git-wip-us.apache.org/repos/asf/commons-math/blob/df46ed5e/src/main/java/org/apache/commons/math4/random/Well1024a.java
--
diff --git a/src/main/java/org/apache/commons/math4/random/Well1024a.java 
b/src/main/java/org/apache/commons/math4/random/Well1024a.java
index ff1de07..39153f2 100644
--- a/src/main/java/org/apache/commons/math4/random/Well1024a.java
+++ b/src/main/java/org/apache/commons/math4/random/Well1024a.java
@@ -16,18 +16,15 @@
  */
 package org.apache.commons.math4.random;
 
-/**
- * This class implements the WELL1024a pseudo-random number generator
+/** This class implements the WELL1024a pseudo-random number generator
  * from Franois Panneton, Pierre L'Ecuyer and Makoto Matsumoto.
- *
  * 
  * This generator is described in a paper by Franois Panneton,
- * Pierre L'Ecuyer and Makoto Matsumoto
- * http://www.iro.umontreal.ca/~lecuyer/myftp/papers/wellrng.pdf;>
- * Improved Long-Period Generators Based on Linear Recurrences Modulo 2
- * ACM Transactions on Mathematical Software, 32, 1 (2006). The errata for the 
paper
- * are in http://www.iro.umontreal.ca/~lecuyer/myftp/papers/wellrng-errata.txt;>wellrng-errata.txt.
- * 
+ * Pierre L'Ecuyer and Makoto Matsumoto http://www.iro.umontreal.ca/~lecuyer/myftp/papers/wellrng.pdf;>Improved
+ * Long-Period Generators Based on Linear Recurrences Modulo 2 ACM
+ * Transactions on Mathematical Software, 32, 1 (2006). The errata for the 
paper
+ * are in http://www.iro.umontreal.ca/~lecuyer/myftp/papers/wellrng-errata.txt;>wellrng-errata.txt.
  *
  * @see http://www.iro.umontreal.ca/~panneton/WELLRNG.html;>WELL 
Random number generator
  * @since 2.2
@@ -8

[15/22] [math] Reverting commit 4fc5b3402c58d6a4b317bf23b896ea91d22af6fe as per Gilles request.

2016-01-17 Thread luc
Reverting commit 4fc5b3402c58d6a4b317bf23b896ea91d22af6fe as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/a4456b8f
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/a4456b8f
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/a4456b8f

Branch: refs/heads/master
Commit: a4456b8fd51adf73e007cb7d598bf2feb3e4f6df
Parents: 56888aa
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:35:25 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../commons/math4/random/MersenneTwister.java   | 41 +++-
 1 file changed, 13 insertions(+), 28 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/a4456b8f/src/main/java/org/apache/commons/math4/random/MersenneTwister.java
--
diff --git a/src/main/java/org/apache/commons/math4/random/MersenneTwister.java 
b/src/main/java/org/apache/commons/math4/random/MersenneTwister.java
index 1228b4e..709c343 100644
--- a/src/main/java/org/apache/commons/math4/random/MersenneTwister.java
+++ b/src/main/java/org/apache/commons/math4/random/MersenneTwister.java
@@ -111,7 +111,7 @@ public class MersenneTwister
  */
 public MersenneTwister() {
 mt = new int[N];
-setSeedInternal(System.currentTimeMillis() + 
System.identityHashCode(this));
+setSeed(System.currentTimeMillis() + System.identityHashCode(this));
 }
 
 /** Creates a new random number generator using a single int seed.
@@ -119,7 +119,7 @@ public class MersenneTwister
  */
 public MersenneTwister(int seed) {
 mt = new int[N];
-setSeedInternal(seed);
+setSeed(seed);
 }
 
 /** Creates a new random number generator using an int array seed.
@@ -128,7 +128,7 @@ public class MersenneTwister
  */
 public MersenneTwister(int[] seed) {
 mt = new int[N];
-setSeedInternal(seed);
+setSeed(seed);
 }
 
 /** Creates a new random number generator using a single long seed.
@@ -136,25 +136,7 @@ public class MersenneTwister
  */
 public MersenneTwister(long seed) {
 mt = new int[N];
-setSeedInternal(seed);
-}
-
-/** {@inheritDoc} */
-@Override
-public void setSeed(int seed) {
-setSeedInternal(seed);
-}
-
-/** {@inheritDoc} */
-@Override
-public void setSeed(int[] seed) {
-setSeedInternal(seed);
-}
-
-/** {@inheritDoc} */
-@Override
-public void setSeed(long seed) {
-setSeedInternal(seed);
+setSeed(seed);
 }
 
 /** Reinitialize the generator as if just built with the given int seed.
@@ -162,7 +144,8 @@ public class MersenneTwister
  * generator built with the same seed.
  * @param seed the initial seed (32 bits integer)
  */
-private void setSeedInternal(int seed) {
+@Override
+public void setSeed(int seed) {
 // we use a long masked by 0xL as a poor man unsigned int
 long longMT = seed;
 // NB: unlike original C code, we are working with java longs, the 
cast below makes masking unnecessary
@@ -184,14 +167,15 @@ public class MersenneTwister
  * the seed of the generator will be the current system time plus the
  * system identity hash code of this instance
  */
-private void setSeedInternal(int[] seed) {
+@Override
+public void setSeed(int[] seed) {
 
 if (seed == null) {
-setSeedInternal(System.currentTimeMillis() + 
System.identityHashCode(this));
+setSeed(System.currentTimeMillis() + 
System.identityHashCode(this));
 return;
 }
 
-setSeedInternal(19650218);
+setSeed(19650218);
 int i = 1;
 int j = 0;
 
@@ -233,8 +217,9 @@ public class MersenneTwister
  * generator built with the same seed.
  * @param seed the initial seed (64 bits integer)
  */
-private void setSeedInternal(long seed) {
-setSeedInternal(new int[] { (int) (seed >>> 32), (int) (seed & 
0xl) });
+@Override
+public void setSeed(long seed) {
+setSeed(new int[] { (int) (seed >>> 32), (int) (seed & 0xl) });
 }
 
 /**



[12/22] [math] Reverting commit 8a35ca4f8e19b914a8503d1d5156212363cbaf10 as per Gilles request.

2016-01-17 Thread luc
Reverting commit 8a35ca4f8e19b914a8503d1d5156212363cbaf10 as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/e0a8ac4f
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/e0a8ac4f
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/e0a8ac4f

Branch: refs/heads/master
Commit: e0a8ac4fb5891e6760f7238027dcbb3e23e23054
Parents: 16f46dc
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:35:24 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../math4/random/AbstractRandomGenerator.java   | 294 +++
 .../random/AbstractRandomGeneratorTest.java |  39 +++
 .../math4/random/TestRandomGenerator.java   |  43 +++
 3 files changed, 376 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/e0a8ac4f/src/main/java/org/apache/commons/math4/random/AbstractRandomGenerator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/random/AbstractRandomGenerator.java 
b/src/main/java/org/apache/commons/math4/random/AbstractRandomGenerator.java
new file mode 100644
index 000..2115dbd
--- /dev/null
+++ b/src/main/java/org/apache/commons/math4/random/AbstractRandomGenerator.java
@@ -0,0 +1,294 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math4.random;
+
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.util.FastMath;
+
+/**
+ * Abstract class implementing the {@link  RandomGenerator} interface.
+ * Default implementations for all methods other than {@link #nextDouble()} and
+ * {@link #setSeed(long)} are provided.
+ * 
+ * All data generation methods are based on {@code code nextDouble()}.
+ * Concrete implementations must override
+ * this method and should provide better / more
+ * performant implementations of the other methods if the underlying PRNG
+ * supplies them.
+ *
+ * @since 1.1
+ */
+public abstract class AbstractRandomGenerator implements RandomGenerator {
+
+/**
+ * Cached random normal value.  The default implementation for
+ * {@link #nextGaussian} generates pairs of values and this field caches 
the
+ * second value so that the full algorithm is not executed for every
+ * activation.  The value {@code Double.NaN} signals that there is
+ * no cached value.  Use {@link #clear} to clear the cached value.
+ */
+private double cachedNormalDeviate = Double.NaN;
+
+/**
+ * Construct a RandomGenerator.
+ */
+public AbstractRandomGenerator() {
+super();
+
+}
+
+/**
+ * Clears the cache used by the default implementation of
+ * {@link #nextGaussian}. Implementations that do not override the
+ * default implementation of {@code nextGaussian} should call this
+ * method in the implementation of {@link #setSeed(long)}
+ */
+public void clear() {
+cachedNormalDeviate = Double.NaN;
+}
+
+/** {@inheritDoc} */
+@Override
+public void setSeed(int seed) {
+setSeed((long) seed);
+}
+
+/** {@inheritDoc} */
+@Override
+public void setSeed(int[] seed) {
+// the following number is the largest prime that fits in 32 bits (it 
is 2^32 - 5)
+final long prime = 4294967291l;
+
+long combined = 0l;
+for (int s : seed) {
+combined = combined * prime + s;
+}
+setSeed(combined);
+}
+
+/**
+ * Sets the seed of the underlying random number generator using a
+ * {@code long} seed.  Sequences of values generated starting with the
+ * same seeds should be identical.
+ * 
+ * Implementations that do not override the default implementation of
+ * {@code nextGaussian} should include a call to {@link #clear} in the
+

[03/22] [math] Reverting commit f9e72000a17eb9d524b38a9f2c982c037dd94891 as per Gilles request.

2016-01-17 Thread luc
Reverting commit f9e72000a17eb9d524b38a9f2c982c037dd94891 as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/7c31eb66
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/7c31eb66
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/7c31eb66

Branch: refs/heads/master
Commit: 7c31eb6634d55db044b6c4297d38550a9b248046
Parents: 5b940aa
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:35:25 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../commons/math4/random/AbstractWell.java  | 90 +---
 .../commons/math4/random/MersenneTwister.java   | 21 ++---
 2 files changed, 47 insertions(+), 64 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/7c31eb66/src/main/java/org/apache/commons/math4/random/AbstractWell.java
--
diff --git a/src/main/java/org/apache/commons/math4/random/AbstractWell.java 
b/src/main/java/org/apache/commons/math4/random/AbstractWell.java
index a389d58..da222fd 100644
--- a/src/main/java/org/apache/commons/math4/random/AbstractWell.java
+++ b/src/main/java/org/apache/commons/math4/random/AbstractWell.java
@@ -37,82 +37,73 @@ import org.apache.commons.math4.util.FastMath;
 public abstract class AbstractWell
 extends BaseRandomGenerator
 implements Serializable {
+
 /** Serializable version identifier. */
 private static final long serialVersionUID = 20150228L;
+
 /** Current index in the bytes pool. */
 protected int index;
+
 /** Bytes pool. */
 protected final int[] v;
 
-/**
- * Creates a new random number generator.
- *
+/** Creates a new random number generator.
  * The instance is initialized using the current time plus the
  * system identity hash code of this instance as the seed.
- *
- * @param k number of bits in the pool (not necessarily a multiple of 32).
+ * @param k number of bits in the pool (not necessarily a multiple of 32)
  */
 protected AbstractWell(final int k) {
 this(k, null);
 }
 
-/**
- * Creates a new random number generator using a single int seed.
- *
- * @param k number of bits in the pool (not necessarily a multiple of 32).
- * @param seed the initial seed (32 bits integer).
+/** Creates a new random number generator using a single int seed.
+ * @param k number of bits in the pool (not necessarily a multiple of 32)
+ * @param seed the initial seed (32 bits integer)
  */
 protected AbstractWell(final int k, final int seed) {
 this(k, new int[] { seed });
 }
 
-/**
- * Creates a new random number generator using an int array seed.
- *
- * @param k number of bits in the pool (not necessarily a multiple of 32).
+/** Creates a new random number generator using an int array seed.
+ * @param k number of bits in the pool (not necessarily a multiple of 32)
  * @param seed the initial seed (32 bits integers array), if null
- * the seed of the generator will be related to the current time.
+ * the seed of the generator will be related to the current time
  */
 protected AbstractWell(final int k, final int[] seed) {
+
 final int r = calculateBlockCount(k);
-v = new int[r];
-index = 0;
+this.v  = new int[r];
+this.index  = 0;
 
-// Initialize the pool content.
+// initialize the pool content
 setSeed(seed);
+
 }
 
-/**
- * Creates a new random number generator using a single long seed.
- *
- * @param k number of bits in the pool (not necessarily a multiple of 32).
- * @param seed the initial seed (64 bits integer).
+/** Creates a new random number generator using a single long seed.
+ * @param k number of bits in the pool (not necessarily a multiple of 32)
+ * @param seed the initial seed (64 bits integer)
  */
 protected AbstractWell(final int k, final long seed) {
 this(k, new int[] { (int) (seed >>> 32), (int) (seed & 0xl) });
 }
 
-/**
- * Reinitialize the generator as if just built with the given int seed.
- *
- * The state of the generator is exactly the same as a new generator
- * built with the same seed.
- *
- * @param seed Seed (32 bits integer).
+/** Reinitialize the generator as if just built with the given int seed.
+ * The state of the generator is exactly the same as a new
+ * generator built with the same seed.
+ * @param seed the initial seed (32 bits integer

[13/22] [math] Reverting commit d8e2f892e48423fda73204be3ec239d282e71c65 as per Gilles request.

2016-01-17 Thread luc
Reverting commit d8e2f892e48423fda73204be3ec239d282e71c65 as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/4abfe08a
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/4abfe08a
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/4abfe08a

Branch: refs/heads/master
Commit: 4abfe08ae38927921ce2d754f0fde4221fccbed7
Parents: b144fa5
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:35:24 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../distribution/ZipfDistributionTest.java  | 37 
 1 file changed, 15 insertions(+), 22 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/4abfe08a/src/test/java/org/apache/commons/math4/distribution/ZipfDistributionTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/distribution/ZipfDistributionTest.java 
b/src/test/java/org/apache/commons/math4/distribution/ZipfDistributionTest.java
index 1a71626..eeae81f 100644
--- 
a/src/test/java/org/apache/commons/math4/distribution/ZipfDistributionTest.java
+++ 
b/src/test/java/org/apache/commons/math4/distribution/ZipfDistributionTest.java
@@ -20,7 +20,7 @@ package org.apache.commons.math4.distribution;
 import org.apache.commons.math4.TestUtils;
 import 
org.apache.commons.math4.distribution.ZipfDistribution.ZipfRejectionInversionSampler;
 import org.apache.commons.math4.exception.NotStrictlyPositiveException;
-import org.apache.commons.math4.random.BaseRandomGenerator;
+import org.apache.commons.math4.random.AbstractRandomGenerator;
 import org.apache.commons.math4.random.RandomGenerator;
 import org.apache.commons.math4.random.Well1024a;
 import org.apache.commons.math4.util.FastMath;
@@ -215,27 +215,20 @@ public class ZipfDistributionTest extends 
IntegerDistributionAbstractTest {
 long start = System.currentTimeMillis();
 final int[] randomNumberCounter = new int[1];
 
-RandomGenerator randomGenerator  = new BaseRandomGenerator() {
-private final RandomGenerator r = new Well1024a(0L);
-
-@Override
-public void setSeed(long s) {
-r.setSeed(s);
-}
-@Override
-public void setSeed(int s) {
-r.setSeed(s);
-}
-@Override
-public void setSeed(int[] s) {
-r.setSeed(s);
-}
-@Override
-public int nextInt() {
-randomNumberCounter[0] += 1;
-return r.nextInt();
-}
-};
+RandomGenerator randomGenerator  = new 
AbstractRandomGenerator() {
+
+private final RandomGenerator r = new Well1024a(0L);
+
+@Override
+public void setSeed(long seed) {
+}
+
+@Override
+public double nextDouble() {
+randomNumberCounter[0]+=1;
+return r.nextDouble();
+}
+};
 
 final ZipfDistribution distribution = new 
ZipfDistribution(randomGenerator, numPoints, exponent);
 for (int i = 0; i < numGeneratedSamples; ++i) {



[07/22] [math] Reverting commit 8f6bedeb724fa78583c26423aaece05cfddc04c9 as per Gilles request.

2016-01-17 Thread luc
Reverting commit 8f6bedeb724fa78583c26423aaece05cfddc04c9 as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/81288e46
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/81288e46
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/81288e46

Branch: refs/heads/master
Commit: 81288e460f85d71a5f0815615051fe0cdde82039
Parents: 2edc62a
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:30:24 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../java/org/apache/commons/math4/random/AbstractWell.java | 2 +-
 src/main/java/org/apache/commons/math4/random/ISAACRandom.java | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/81288e46/src/main/java/org/apache/commons/math4/random/AbstractWell.java
--
diff --git a/src/main/java/org/apache/commons/math4/random/AbstractWell.java 
b/src/main/java/org/apache/commons/math4/random/AbstractWell.java
index 461e547..88cb2bb 100644
--- a/src/main/java/org/apache/commons/math4/random/AbstractWell.java
+++ b/src/main/java/org/apache/commons/math4/random/AbstractWell.java
@@ -134,7 +134,7 @@ public abstract class AbstractWell
  */
 private void setSeedInternal(final int[] seed) {
 if (seed == null) {
-setSeedInternal(System.currentTimeMillis() + 
System.identityHashCode(this));
+setSeed(System.currentTimeMillis() + 
System.identityHashCode(this));
 return;
 }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/81288e46/src/main/java/org/apache/commons/math4/random/ISAACRandom.java
--
diff --git a/src/main/java/org/apache/commons/math4/random/ISAACRandom.java 
b/src/main/java/org/apache/commons/math4/random/ISAACRandom.java
index 4759749..185710f 100644
--- a/src/main/java/org/apache/commons/math4/random/ISAACRandom.java
+++ b/src/main/java/org/apache/commons/math4/random/ISAACRandom.java
@@ -131,7 +131,7 @@ public class ISAACRandom
  * @param seed Seed.
  */
 private void setSeedInternal(int seed) {
-setSeedInternal(new int[] { seed });
+setSeed(new int[]{seed});
 }
 
 /**
@@ -140,7 +140,7 @@ public class ISAACRandom
  * @param seed Seed.
  */
 private void setSeedInternal(long seed) {
-setSeedInternal(new int[] { (int) (seed >>> 32), (int) (seed & 
0xL) });
+setSeed(new int[]{(int) (seed >>> 32), (int) (seed & 0xL)});
 }
 
 /**
@@ -150,7 +150,7 @@ public class ISAACRandom
  */
 private void setSeedInternal(int[] seed) {
 if (seed == null) {
-setSeedInternal(System.currentTimeMillis() + 
System.identityHashCode(this));
+setSeed(System.currentTimeMillis() + 
System.identityHashCode(this));
 return;
 }
 final int seedLen = seed.length;



[09/22] [math] Reverting commit 81585a3c46bb05e86e11d88ba25d14b90d488577 as per Gilles request.

2016-01-17 Thread luc
Reverting commit 81585a3c46bb05e86e11d88ba25d14b90d488577 as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/cf82e4ca
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/cf82e4ca
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/cf82e4ca

Branch: refs/heads/master
Commit: cf82e4cab4ef662f2ba98e539e76e8ea0943cd33
Parents: 81a6c88
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:34:48 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 src/changes/changes.xml | 15 ---
 1 file changed, 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/cf82e4ca/src/changes/changes.xml
--
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 881cf52..6bb0189 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -54,21 +54,6 @@ If the output is not quite correct, check for invisible 
trailing spaces!
 
 
 
-  
-Removed obsolete class "AbstractRandomGenerator" (package 
"o.a.c.m.random").
-  
-  
-New method "nextBytes(byte[],int,int)" in "BaseRandomGenerator"
-for partial filling of the user-supplied array.
-  
-  
-Remove calls to public methods "setSeed" from constructors (in RNG 
implementations).
-  
-  
-New base class for all RNG implementations: "BaseRandomGenerator" 
replaces
-"BitsStreamGenerator" whose method "nextInt(int)" is replaced by 
"nextInt()"
-as the generator of randomness that must be implemented in concrete 
subclasses.
-  
   
 "JDKRandomGenerator": Method "nextInt(int)" now throws a 
"NotStrictlyPositiveException".
 The class now delegates to (rather inherits from) "java.util.Random".



[10/22] [math] Reverting commit 8d6d088622f8e4ea89e66ccbe097510fb4c932fd as per Gilles request.

2016-01-17 Thread luc
Reverting commit 8d6d088622f8e4ea89e66ccbe097510fb4c932fd as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/16f46dcc
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/16f46dcc
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/16f46dcc

Branch: refs/heads/master
Commit: 16f46dcc3df28afa0231fa68a6f43ec9ca44b0d1
Parents: cf82e4c
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:35:24 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../java/org/apache/commons/math4/random/BaseRandomGenerator.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/16f46dcc/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java 
b/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
index da801b0..2d78005 100644
--- a/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
@@ -120,7 +120,7 @@ public abstract class BaseRandomGenerator
 int bits;
 int val;
 do {
-bits = nextInt() >>> 1;
+bits = (nextInt() >>> 1);
 val = bits % n;
 } while (bits - val + (n - 1) < 0);
 return val;



[05/22] [math] Reverting commit 66608db56c41e91ee34fdc1e6157d69b69893fad as per Gilles request.

2016-01-17 Thread luc
Reverting commit 66608db56c41e91ee34fdc1e6157d69b69893fad as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/068e4f17
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/068e4f17
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/068e4f17

Branch: refs/heads/master
Commit: 068e4f1792bd2b157e6ed6703e792d628f1bff00
Parents: 4742149
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:30:23 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../apache/commons/math4/random/RandomGeneratorAbstractTest.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/068e4f17/src/test/java/org/apache/commons/math4/random/RandomGeneratorAbstractTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/random/RandomGeneratorAbstractTest.java
 
b/src/test/java/org/apache/commons/math4/random/RandomGeneratorAbstractTest.java
index 7c0384e..829f350 100644
--- 
a/src/test/java/org/apache/commons/math4/random/RandomGeneratorAbstractTest.java
+++ 
b/src/test/java/org/apache/commons/math4/random/RandomGeneratorAbstractTest.java
@@ -428,7 +428,7 @@ public abstract class RandomGeneratorAbstractTest extends 
RandomDataGeneratorTes
 for (int i = 0; i < len; i++) {
 values[1][i] = gen2.nextGaussian();
 }
-TestUtils.assertEquals(values[0], values[1], 0d);
+Assert.assertTrue(Arrays.equals(values[0], values[1]));
 }
 
 // MATH-1300



[11/22] [math] Reverting commit aaabfe8d2d8d8c963310cdbd8fd0e81c50006992 as per Gilles request.

2016-01-17 Thread luc
Reverting commit aaabfe8d2d8d8c963310cdbd8fd0e81c50006992 as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/b144fa56
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/b144fa56
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/b144fa56

Branch: refs/heads/master
Commit: b144fa56326cc19a424fc287b4d22e8a6aeed3f4
Parents: 15a7ab8
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:35:24 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../commons/math4/random/RandomGenerator.java   |  4 +--
 .../commons/math4/random/package-info.java  | 26 +---
 2 files changed, 13 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/b144fa56/src/main/java/org/apache/commons/math4/random/RandomGenerator.java
--
diff --git a/src/main/java/org/apache/commons/math4/random/RandomGenerator.java 
b/src/main/java/org/apache/commons/math4/random/RandomGenerator.java
index b1e7e5e..8e0b5b1 100644
--- a/src/main/java/org/apache/commons/math4/random/RandomGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/RandomGenerator.java
@@ -18,8 +18,8 @@ package org.apache.commons.math4.random;
 
 
 /**
- * Interface extracted from java.util.Random.
- * This interface is implemented by {@link BaseRandomGenerator}.
+ * Interface extracted from java.util.Random.  This interface is
+ * implemented by {@link AbstractRandomGenerator}.
  *
  * @since 1.1
  */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/b144fa56/src/main/java/org/apache/commons/math4/random/package-info.java
--
diff --git a/src/main/java/org/apache/commons/math4/random/package-info.java 
b/src/main/java/org/apache/commons/math4/random/package-info.java
index 0eec009..4d42815 100644
--- a/src/main/java/org/apache/commons/math4/random/package-info.java
+++ b/src/main/java/org/apache/commons/math4/random/package-info.java
@@ -17,29 +17,25 @@
 /**
  *
  *  Random number and random data generators.
- *  
- *   Commons Math provides a few pseudo-random number generators.
- *   The top level interface is {@link RandomGenerator}.
- *   It is implemented by the following classes:
- *   
- *
- * {@link org.apache.commons.math4.random.JDKRandomGenerator 
JDKRandomGenerator}
- * that delegates to the JDK provided generator
- *
- *
- *BaseRandomGenerator as a base class for concrete generators:
+ *  Commons-math provides a few pseudo random number generators. The 
top level interface is RandomGenerator.
+ *  It is implemented by three classes:
+ *  
+ *{@link org.apache.commons.math4.random.JDKRandomGenerator 
JDKRandomGenerator}
+ *that extends the JDK provided generator
+ *AbstractRandomGenerator as a helper for users generators
+ *BitStreamGenerator which is an abstract class for several 
generators and
+ *which in turn is extended by:
  *
- *  {@link org.apache.commons.math4.random.ISAACRandom 
ISAAC}
+ *  {@link org.apache.commons.math4.random.MersenneTwister 
MersenneTwister}
  *  {@link org.apache.commons.math4.random.Well512a 
Well512a}
  *  {@link org.apache.commons.math4.random.Well1024a 
Well1024a}
  *  {@link org.apache.commons.math4.random.Well19937a 
Well19937a}
  *  {@link org.apache.commons.math4.random.Well19937c 
Well19937c}
  *  {@link org.apache.commons.math4.random.Well44497a 
Well44497a}
  *  {@link org.apache.commons.math4.random.Well44497b 
Well44497b}
- *  {@link org.apache.commons.math4.random.MersenneTwister 
MersenneTwister}
  *
- *
- *   
+ *  
+ *
  *  
  *
  *  



[21/22] [math] Reverting commit 2a8061f4ad8903a9c6d46b404973bdbd84385d39 as per Gilles request.

2016-01-17 Thread luc
Reverting commit 2a8061f4ad8903a9c6d46b404973bdbd84385d39 as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/3c2fedeb
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/3c2fedeb
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/3c2fedeb

Branch: refs/heads/master
Commit: 3c2fedeb0901bd347c4b4f546b741de68a2e198a
Parents: e7c659f
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:35:25 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../apache/commons/math4/random/BaseRandomGenerator.java| 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/3c2fedeb/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java 
b/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
index 2d78005..a78fd38 100644
--- a/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
@@ -175,7 +175,8 @@ public abstract class BaseRandomGenerator
  * Generates random bytes and places them into a user-supplied array.
  *
  * 
- * The array is filled with bytes extracted from random integers.
+ * The array is filled with bytes extracted from random integers generated
+ * using {@link #nextInt()}.
  * This implies that the number of random bytes generated may be larger 
than
  * the length of the byte array.
  * 
@@ -191,7 +192,8 @@ public abstract class BaseRandomGenerator
  * Generates random bytes and places them into a user-supplied array.
  *
  * 
- * The array is filled with bytes extracted from random integers.
+ * The array is filled with bytes extracted from random integers generated
+ * using {@link #nextInt()}.
  * This implies that the number of random bytes generated may be larger 
than
  * the length of the byte array.
  * 
@@ -222,7 +224,8 @@ public abstract class BaseRandomGenerator
  * Generates random bytes and places them into a user-supplied array.
  *
  * 
- * The array is filled with bytes extracted from random integers.
+ * The array is filled with bytes extracted from random integers generated
+ * using {@link #nextInt()}.
  * This implies that the number of random bytes generated may be larger 
than
  * the length of the byte array.
  * 



[14/22] [math] Reverting commit ca01fdf5808dcaf5bdb6e1c09a7de70a0adc0d28 as per Gilles request.

2016-01-17 Thread luc
Reverting commit ca01fdf5808dcaf5bdb6e1c09a7de70a0adc0d28 as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/56888aa6
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/56888aa6
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/56888aa6

Branch: refs/heads/master
Commit: 56888aa666b4997a4eeab7d1044f5358c213a178
Parents: 4abfe08
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:35:25 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../math4/random/BitsStreamGenerator.java   | 218 +++
 .../math4/random/BitsStreamGeneratorTest.java   |  86 
 2 files changed, 304 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/56888aa6/src/main/java/org/apache/commons/math4/random/BitsStreamGenerator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/random/BitsStreamGenerator.java 
b/src/main/java/org/apache/commons/math4/random/BitsStreamGenerator.java
new file mode 100644
index 000..4cf6823
--- /dev/null
+++ b/src/main/java/org/apache/commons/math4/random/BitsStreamGenerator.java
@@ -0,0 +1,218 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math4.random;
+
+import java.io.Serializable;
+
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.util.FastMath;
+
+/** Base class for random number generators that generates bits streams.
+ *
+ * @since 2.0
+ */
+public abstract class BitsStreamGenerator
+implements RandomGenerator,
+   Serializable {
+/** Serializable version identifier */
+private static final long serialVersionUID = 20130104L;
+/** Next gaussian. */
+private double nextGaussian;
+
+/**
+ * Creates a new random number generator.
+ */
+public BitsStreamGenerator() {
+nextGaussian = Double.NaN;
+}
+
+/** {@inheritDoc} */
+@Override
+public abstract void setSeed(int seed);
+
+/** {@inheritDoc} */
+@Override
+public abstract void setSeed(int[] seed);
+
+/** {@inheritDoc} */
+@Override
+public abstract void setSeed(long seed);
+
+/** Generate next pseudorandom number.
+ * This method is the core generation algorithm. It is used by all the
+ * public generation methods for the various primitive types {@link
+ * #nextBoolean()}, {@link #nextBytes(byte[])}, {@link #nextDouble()},
+ * {@link #nextFloat()}, {@link #nextGaussian()}, {@link #nextInt()},
+ * {@link #next(int)} and {@link #nextLong()}.
+ * @param bits number of random bits to produce
+ * @return random bits generated
+ */
+protected abstract int next(int bits);
+
+/** {@inheritDoc} */
+@Override
+public boolean nextBoolean() {
+return next(1) != 0;
+}
+
+/** {@inheritDoc} */
+@Override
+public void nextBytes(byte[] bytes) {
+// Multiple 4 part of length (i.e. length with two least significant 
bits unset).
+final int max = bytes.length & 0x7ffc;
+
+int index = 0;
+// Start filling in the byte array, 4 bytes at a time.
+while (index < max) {
+final int random = next(32);
+bytes[index++] = (byte) random;
+bytes[index++] = (byte) (random >>> 8);
+bytes[index++] = (byte) (random >>> 16);
+bytes[index++] = (byte) (random >>> 24);
+}
+
+// Fill in the remaing bytes.
+if (index < bytes.length) {
+int random = next(32);
+while (true) {
+bytes[index++] = (byte) random;
+if (index < bytes.length) {
+   

[08/22] [math] Reverting commit d1123894d33922e7c8ca838f9dac9bdceefa3f7a as per Gilles request.

2016-01-17 Thread luc
Reverting commit d1123894d33922e7c8ca838f9dac9bdceefa3f7a as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/81a6c887
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/81a6c887
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/81a6c887

Branch: refs/heads/master
Commit: 81a6c88778a6b84c14d07e087f20484f018ef320
Parents: 81288e4
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:30:24 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../commons/math4/random/BaseRandomGenerator.java | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/81a6c887/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java 
b/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
index bc6442e..da801b0 100644
--- a/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
@@ -228,17 +228,17 @@ public abstract class BaseRandomGenerator
  * 
  *
  * @param bytes Array in which to put the generated bytes. Cannot be 
{@code null}.
- * @param start Index at which to start inserting the generated bytes.
- * @param len Number of bytes to insert.
+ * @param position Index at which to start inserting the generated bytes.
+ * @param length Number of bytes to insert.
  */
 private void nextBytesFill(byte[] bytes,
-   int start,
-   int len) {
-int index = start; // Index of first insertion.
+   int position,
+   int length) {
+int index = position; // Index of first insertion.
 
 // Index of first insertion plus multiple 4 part of length (i.e. length
 // with two least significant bits unset).
-final int indexLoopLimit = index + (len & 0x7ffc);
+final int indexLoopLimit = index + (length & 0x7ffc);
 
 // Start filling in the byte array, 4 bytes at a time.
 while (index < indexLoopLimit) {
@@ -249,7 +249,7 @@ public abstract class BaseRandomGenerator
 bytes[index++] = (byte) (random >>> 24);
 }
 
-final int indexLimit = start + len; // Index of last insertion + 1.
+final int indexLimit = position + length; // Index of last insertion + 
1.
 
 // Fill in the remaining bytes.
 if (index < indexLimit) {



[06/22] [math] Reverting commit fdc116f0bcda6d1fffbbe505d0687b0406e92fa6 as per Gilles request.

2016-01-17 Thread luc
Reverting commit fdc116f0bcda6d1fffbbe505d0687b0406e92fa6 as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/2edc62af
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/2edc62af
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/2edc62af

Branch: refs/heads/master
Commit: 2edc62af90db14bd9166eb5e0d8c62eced9351bc
Parents: 068e4f1
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:30:24 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../apache/commons/math4/random/BaseRandomGenerator.java| 9 +
 .../commons/math4/random/BaseRandomGeneratorTest.java   | 7 +++
 2 files changed, 12 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/2edc62af/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java 
b/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
index 9907d71..bc6442e 100644
--- a/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/BaseRandomGenerator.java
@@ -200,7 +200,7 @@ public abstract class BaseRandomGenerator
  * @param start Index at which to start inserting the generated bytes.
  * @param len Number of bytes to insert.
  * @throws OutOfRangeException if {@code start < 0} or {@code start >= 
bytes.length}.
- * @throws OutOfRangeException if {@code len < 0} or {@code len > 
bytes.length - start}.
+ * @throws OutOfRangeException if {@code len <= 0} or {@code len > 
bytes.length - start}.
  */
 public void nextBytes(byte[] bytes,
   int start,
@@ -209,9 +209,10 @@ public abstract class BaseRandomGenerator
 start >= bytes.length) {
 throw new OutOfRangeException(start, 0, bytes.length);
 }
-if (len < 0 ||
-len > bytes.length - start) {
-throw new OutOfRangeException(len, 0, bytes.length - start);
+final int max = bytes.length - start;
+if (len <= 0 ||
+len > max) {
+throw new OutOfRangeException(len, 0, max);
 }
 
 nextBytesFill(bytes, start, len);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/2edc62af/src/test/java/org/apache/commons/math4/random/BaseRandomGeneratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/random/BaseRandomGeneratorTest.java 
b/src/test/java/org/apache/commons/math4/random/BaseRandomGeneratorTest.java
index 13b83ee..40ab9b5 100644
--- a/src/test/java/org/apache/commons/math4/random/BaseRandomGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math4/random/BaseRandomGeneratorTest.java
@@ -63,6 +63,13 @@ public class BaseRandomGeneratorTest extends 
RandomGeneratorAbstractTest {
 public void testNextBytesPrecondition3() {
 final int len = 3;
 final byte[] b = new byte[len];
+baseRandomGenerator.nextBytes(b, 0, 0);
+}
+
+@Test(expected=OutOfRangeException.class)
+public void testNextBytesPrecondition4() {
+final int len = 3;
+final byte[] b = new byte[len];
 baseRandomGenerator.nextBytes(b, 0, len + 1);
 }
 



[17/22] [math] Reverting commit 581b474f4b194731eb9cb22cdde7330a1ec81c3b as per Gilles request.

2016-01-17 Thread luc
Reverting commit 581b474f4b194731eb9cb22cdde7330a1ec81c3b as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/32280b86
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/32280b86
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/32280b86

Branch: refs/heads/master
Commit: 32280b862c77e64fcd104da16bd1b588026c0be6
Parents: 794dda1
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:35:25 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../commons/math4/random/AbstractWell.java  | 34 ++--
 1 file changed, 9 insertions(+), 25 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/32280b86/src/main/java/org/apache/commons/math4/random/AbstractWell.java
--
diff --git a/src/main/java/org/apache/commons/math4/random/AbstractWell.java 
b/src/main/java/org/apache/commons/math4/random/AbstractWell.java
index 88cb2bb..b2d61a3 100644
--- a/src/main/java/org/apache/commons/math4/random/AbstractWell.java
+++ b/src/main/java/org/apache/commons/math4/random/AbstractWell.java
@@ -79,7 +79,7 @@ public abstract class AbstractWell
 index = 0;
 
 // Initialize the pool content.
-setSeedInternal(seed);
+setSeed(seed);
 }
 
 /**
@@ -92,25 +92,6 @@ public abstract class AbstractWell
 this(k, new int[] { (int) (seed >>> 32), (int) (seed & 0xl) });
 }
 
-
-/** {@inheritDoc} */
-@Override
-public void setSeed(int seed) {
-setSeedInternal(seed);
-}
-
-/** {@inheritDoc} */
-@Override
-public void setSeed(int[] seed) {
-setSeedInternal(seed);
-}
-
-/** {@inheritDoc} */
-@Override
-public void setSeed(long seed) {
-setSeedInternal(seed);
-}
-
 /**
  * Reinitialize the generator as if just built with the given int seed.
  *
@@ -119,8 +100,9 @@ public abstract class AbstractWell
  *
  * @param seed Seed (32 bits integer).
  */
-private void setSeedInternal(final int seed) {
-setSeedInternal(new int[] { seed });
+@Override
+public void setSeed(final int seed) {
+setSeed(new int[] { seed });
 }
 
 /**
@@ -132,7 +114,8 @@ public abstract class AbstractWell
  * @param seed Seed (32 bits integers array). If null the seed of the 
generator
  * will be the system time plus the system identity hash code of the 
instance.
  */
-private void setSeedInternal(final int[] seed) {
+@Override
+public void setSeed(final int[] seed) {
 if (seed == null) {
 setSeed(System.currentTimeMillis() + 
System.identityHashCode(this));
 return;
@@ -159,8 +142,9 @@ public abstract class AbstractWell
  *
  * @param seed Seed (64 bits integer).
  */
-private void setSeedInternal(final long seed) {
-setSeedInternal(new int[] { (int) (seed >>> 32), (int) (seed & 
0xl) });
+@Override
+public void setSeed(final long seed) {
+setSeed(new int[] { (int) (seed >>> 32), (int) (seed & 0xl) });
 }
 
 /**



[19/22] [math] Reverting commit e34f50dd1083fa8ed9fe25fe701b64bd2ea7efc0 as per Gilles request.

2016-01-17 Thread luc
Reverting commit e34f50dd1083fa8ed9fe25fe701b64bd2ea7efc0 as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/5b940aaf
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/5b940aaf
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/5b940aaf

Branch: refs/heads/master
Commit: 5b940aaf301c4fc3b1b8e1b9c9b4e419d987ddf0
Parents: 32280b8
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:35:25 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 src/main/java/org/apache/commons/math4/random/AbstractWell.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/5b940aaf/src/main/java/org/apache/commons/math4/random/AbstractWell.java
--
diff --git a/src/main/java/org/apache/commons/math4/random/AbstractWell.java 
b/src/main/java/org/apache/commons/math4/random/AbstractWell.java
index b2d61a3..a389d58 100644
--- a/src/main/java/org/apache/commons/math4/random/AbstractWell.java
+++ b/src/main/java/org/apache/commons/math4/random/AbstractWell.java
@@ -38,7 +38,7 @@ public abstract class AbstractWell
 extends BaseRandomGenerator
 implements Serializable {
 /** Serializable version identifier. */
-private static final long serialVersionUID = 20151228L;
+private static final long serialVersionUID = 20150228L;
 /** Current index in the bytes pool. */
 protected int index;
 /** Bytes pool. */



[16/22] [math] Reverting commit e0d17fed51f5018fc34578699d824c20efc44368 as per Gilles request.

2016-01-17 Thread luc
Reverting commit e0d17fed51f5018fc34578699d824c20efc44368 as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/794dda1f
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/794dda1f
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/794dda1f

Branch: refs/heads/master
Commit: 794dda1fbb2d54dd54934e88d9867ada0c7ac54d
Parents: a4456b8
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:35:25 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../commons/math4/random/ISAACRandom.java   | 41 
 1 file changed, 7 insertions(+), 34 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/794dda1f/src/main/java/org/apache/commons/math4/random/ISAACRandom.java
--
diff --git a/src/main/java/org/apache/commons/math4/random/ISAACRandom.java 
b/src/main/java/org/apache/commons/math4/random/ISAACRandom.java
index 185710f..b9c0e36 100644
--- a/src/main/java/org/apache/commons/math4/random/ISAACRandom.java
+++ b/src/main/java/org/apache/commons/math4/random/ISAACRandom.java
@@ -85,7 +85,7 @@ public class ISAACRandom
  * current time and system hash code of the instance as the seed.
  */
 public ISAACRandom() {
-setSeedInternal(System.currentTimeMillis() + 
System.identityHashCode(this));
+setSeed(System.currentTimeMillis() + System.identityHashCode(this));
 }
 
 /**
@@ -94,7 +94,7 @@ public class ISAACRandom
  * @param seed Initial seed.
  */
 public ISAACRandom(long seed) {
-setSeedInternal(seed);
+setSeed(seed);
 }
 
 /**
@@ -104,51 +104,24 @@ public class ISAACRandom
  * to the current time.
  */
 public ISAACRandom(int[] seed) {
-setSeedInternal(seed);
+setSeed(seed);
 }
 
 /** {@inheritDoc} */
 @Override
 public void setSeed(int seed) {
-setSeedInternal(seed);
-}
-
-/** {@inheritDoc} */
-@Override
-public void setSeed(int[] seed) {
-setSeedInternal(seed);
+setSeed(new int[]{seed});
 }
 
 /** {@inheritDoc} */
 @Override
 public void setSeed(long seed) {
-setSeedInternal(seed);
-}
-
-/**
- * Reseeds the RNG.
- *
- * @param seed Seed.
- */
-private void setSeedInternal(int seed) {
-setSeed(new int[]{seed});
-}
-
-/**
- * Reseeds the RNG.
- *
- * @param seed Seed.
- */
-private void setSeedInternal(long seed) {
 setSeed(new int[]{(int) (seed >>> 32), (int) (seed & 0xL)});
 }
 
-/**
- * Reseeds the RNG.
- *
- * @param seed Seed.
- */
-private void setSeedInternal(int[] seed) {
+/** {@inheritDoc} */
+@Override
+public void setSeed(int[] seed) {
 if (seed == null) {
 setSeed(System.currentTimeMillis() + 
System.identityHashCode(this));
 return;



[02/22] [math] Reverting commit 6f4f676c4b730f7639deef9af205b596fa0aab8e as per Gilles request.

2016-01-17 Thread luc
Reverting commit 6f4f676c4b730f7639deef9af205b596fa0aab8e as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/e7c659f5
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/e7c659f5
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/e7c659f5

Branch: refs/heads/master
Commit: e7c659f5909c6fbc6c985f1e639473f3174be870
Parents: 17bc99f
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:35:25 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../commons/math4/random/RandomGeneratorAbstractTest.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/e7c659f5/src/test/java/org/apache/commons/math4/random/RandomGeneratorAbstractTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/random/RandomGeneratorAbstractTest.java
 
b/src/test/java/org/apache/commons/math4/random/RandomGeneratorAbstractTest.java
index 829f350..f4ddfbd 100644
--- 
a/src/test/java/org/apache/commons/math4/random/RandomGeneratorAbstractTest.java
+++ 
b/src/test/java/org/apache/commons/math4/random/RandomGeneratorAbstractTest.java
@@ -43,13 +43,13 @@ import org.junit.Test;
  */
 
 public abstract class RandomGeneratorAbstractTest extends 
RandomDataGeneratorTest {
-/** Generator to test. */
+
+/** RandomGenerator under test */
 protected RandomGenerator generator;
 
 /**
  * Override this method in subclasses to provide a concrete generator to 
test.
- *
- * @return a new generator seeded with a fixed seed.
+ * Return a generator seeded with a fixed seed.
  */
 protected abstract RandomGenerator makeGenerator();
 



[20/22] [math] Reverting commit 921d0d60d40d8fbda29f14a64e848c70026ea32e as per Gilles request.

2016-01-17 Thread luc
Reverting commit 921d0d60d40d8fbda29f14a64e848c70026ea32e as per Gilles request.

The work on revamping the random packages is perfoemd in the random-ravamp 
branch.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/aaf4027b
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/aaf4027b
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/aaf4027b

Branch: refs/heads/master
Commit: aaf4027bfb90785279ce2ee68bdf056380b8ff1c
Parents: df46ed5
Author: Luc Maisonobe <l...@apache.org>
Authored: Sun Jan 17 11:35:25 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sun Jan 17 11:40:27 2016 +0100

--
 .../java/org/apache/commons/math4/random/ISAACRandom.java | 10 --
 .../java/org/apache/commons/math4/random/ISAACTest.java   |  2 +-
 2 files changed, 5 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/aaf4027b/src/main/java/org/apache/commons/math4/random/ISAACRandom.java
--
diff --git a/src/main/java/org/apache/commons/math4/random/ISAACRandom.java 
b/src/main/java/org/apache/commons/math4/random/ISAACRandom.java
index b9c0e36..ed07ddf 100644
--- a/src/main/java/org/apache/commons/math4/random/ISAACRandom.java
+++ b/src/main/java/org/apache/commons/math4/random/ISAACRandom.java
@@ -41,11 +41,9 @@ import org.apache.commons.math4.util.FastMath;
  *
  * @since 3.0
  */
-public class ISAACRandom
-extends BaseRandomGenerator
-implements Serializable {
+public class ISAACRandom extends BitsStreamGenerator implements Serializable {
 /** Serializable version identifier */
-private static final long serialVersionUID = 20151227L;
+private static final long serialVersionUID = 7288197941165002400L;
 /** Log of size of rsl[] and mem[] */
 private static final int SIZE_L = 8;
 /** Size of rsl[] and mem[] */
@@ -140,12 +138,12 @@ public class ISAACRandom
 
 /** {@inheritDoc} */
 @Override
-public int nextInt() {
+protected int next(int bits) {
 if (count < 0) {
 isaac();
 count = SIZE - 1;
 }
-return rsl[count--];
+return rsl[count--] >>> 32 - bits;
 }
 
 /** Generate 256 results */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/aaf4027b/src/test/java/org/apache/commons/math4/random/ISAACTest.java
--
diff --git a/src/test/java/org/apache/commons/math4/random/ISAACTest.java 
b/src/test/java/org/apache/commons/math4/random/ISAACTest.java
index 6db04ba..f8e7e65 100644
--- a/src/test/java/org/apache/commons/math4/random/ISAACTest.java
+++ b/src/test/java/org/apache/commons/math4/random/ISAACTest.java
@@ -22,7 +22,7 @@ import org.apache.commons.math4.random.RandomGenerator;
 import org.junit.Assert;
 import org.junit.Test;
 
-public final class ISAACTest extends BaseRandomGeneratorTest {
+public final class ISAACTest extends RandomGeneratorAbstractTest {
 
 @Override
 protected RandomGenerator makeGenerator() {



[11/50] [abbrv] [math] Added test for Luther step interpolator.

2016-01-06 Thread luc
Added test for Luther step interpolator.

BEWARE! This test does not work yet. It confirms there is a problem
in the step interpolator for Luther integrator.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/b5c1893a
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/b5c1893a
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/b5c1893a

Branch: refs/heads/master
Commit: b5c1893a7069b3771855a58c6feb8a32cc2d3cd8
Parents: 2f8b15a
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:19 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:19 2016 +0100

--
 .../LutherFieldStepInterpolatorTest.java| 44 
 1 file changed, 44 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/b5c1893a/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolatorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolatorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolatorTest.java
new file mode 100644
index 000..de16bb9
--- /dev/null
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolatorTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math4.ode.nonstiff;
+
+
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.ode.FieldEquationsMapper;
+import org.apache.commons.math4.util.Decimal64Field;
+import org.junit.Test;
+
+public class LutherFieldStepInterpolatorTest extends 
AbstractRungeKuttaFieldStepInterpolatorTest {
+
+protected > 
RungeKuttaFieldStepInterpolator
+createInterpolator(Field field, boolean forward, 
FieldEquationsMapper mapper) {
+return new LutherFieldStepInterpolator(field, forward, mapper);
+}
+
+@Test
+public void interpolationAtBounds() {
+doInterpolationAtBounds(Decimal64Field.getInstance(), 1.0e-15);
+}
+
+@Test
+public void interpolationInside() {
+doInterpolationInside(Decimal64Field.getInstance(), 3.3e-14, 7.9e-13);
+}
+
+}



[41/50] [abbrv] [math] typos.

2016-01-06 Thread luc
typos.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/2a498498
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/2a498498
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/2a498498

Branch: refs/heads/master
Commit: 2a4984980af61442ce8b9009c8c86bb94b2bab4c
Parents: 355b55e
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 14:18:08 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 14:18:08 2016 +0100

--
 .../AbstractEmbeddedRungeKuttaFieldIntegratorTest.java   | 6 +++---
 .../ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java  | 8 
 2 files changed, 7 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/2a498498/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
index 9314b27..61372f5 100644
--- 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
@@ -48,7 +48,7 @@ public abstract class 
AbstractEmbeddedRungeKuttaFieldIntegratorTest {
 
 protected abstract > 
EmbeddedRungeKuttaFieldIntegrator
 createIntegrator(Field field, final double minStep, final double 
maxStep,
- final double scalAbsoluteTolerance, final double 
scalRelativeTolerance) ;
+ final double scalAbsoluteTolerance, final double 
scalRelativeTolerance);
 
 protected abstract > 
EmbeddedRungeKuttaFieldIntegrator
 createIntegrator(Field field, final double minStep, final double 
maxStep,
@@ -384,7 +384,7 @@ public abstract class 
AbstractEmbeddedRungeKuttaFieldIntegratorTest {
 public abstract void testBackward();
 
 protected > void doTestBackward(Field 
field,
-  final double 
espilonLast,
+  final double 
epsilonLast,
   final double 
epsilonMaxValue,
   final double 
epsilonMaxTime,
   final String 
name)
@@ -404,7 +404,7 @@ public abstract class 
AbstractEmbeddedRungeKuttaFieldIntegratorTest {
 integ.addStepHandler(handler);
 integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), 
pb.getFinalTime());
 
-Assert.assertEquals(0, handler.getLastError().getReal(), 
espilonLast);
+Assert.assertEquals(0, handler.getLastError().getReal(), 
epsilonLast);
 Assert.assertEquals(0, handler.getMaximalValueError().getReal(), 
epsilonMaxValue);
 Assert.assertEquals(0, handler.getMaximalTimeError().getReal(),  
epsilonMaxTime);
 Assert.assertEquals(name, integ.getName());

http://git-wip-us.apache.org/repos/asf/commons-math/blob/2a498498/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java
index ae56e6b..d79a19f 100644
--- 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java
@@ -285,7 +285,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest 
{
 public abstract void testSmallStep();
 
 protected > void doTestSmallStep(Field 
field,
-   final 
double espilonLast,
+   final 
double epsilonLast,
final 
double epsilonMaxValue,
final 
double epsilonMaxTime,
final 
String name)
@@ -300,7 +300,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest 
{
 integ.addStepHandler(handler);
 integ.integrate(n

[08/50] [abbrv] [math] Added test for classical 3/8 step interpolator.

2016-01-06 Thread luc
Added test for classical 3/8 step interpolator.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/756ba33a
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/756ba33a
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/756ba33a

Branch: refs/heads/master
Commit: 756ba33a2059b2ecaa00b921648391b3daf8742c
Parents: 7139af3
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:16 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:16 2016 +0100

--
 .../ThreeEighthesFieldStepInterpolatorTest.java | 44 
 1 file changed, 44 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/756ba33a/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldStepInterpolatorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldStepInterpolatorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldStepInterpolatorTest.java
new file mode 100644
index 000..9a6d818
--- /dev/null
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldStepInterpolatorTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math4.ode.nonstiff;
+
+
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.ode.FieldEquationsMapper;
+import org.apache.commons.math4.util.Decimal64Field;
+import org.junit.Test;
+
+public class ThreeEighthesFieldStepInterpolatorTest extends 
AbstractRungeKuttaFieldStepInterpolatorTest {
+
+protected > 
RungeKuttaFieldStepInterpolator
+createInterpolator(Field field, boolean forward, 
FieldEquationsMapper mapper) {
+return new ThreeEighthesFieldStepInterpolator(field, forward, 
mapper);
+}
+
+@Test
+public void interpolationAtBounds() {
+doInterpolationAtBounds(Decimal64Field.getInstance(), 1.0e-15);
+}
+
+@Test
+public void interpolationInside() {
+doInterpolationInside(Decimal64Field.getInstance(), 2.6e-7, 3.6e-6);
+}
+
+}



[03/50] [abbrv] [math] Added tests for 3/8 integrator.

2016-01-06 Thread luc
Added tests for 3/8 integrator.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/eef2ed31
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/eef2ed31
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/eef2ed31

Branch: refs/heads/master
Commit: eef2ed3144d873a56cf5f62cd81dddea87d37544
Parents: 34f1f6a
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:09 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:09 2016 +0100

--
 .../ThreeEighthesFieldIntegratorTest.java   | 99 
 1 file changed, 99 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/eef2ed31/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldIntegratorTest.java
new file mode 100644
index 000..3feb0cd
--- /dev/null
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldIntegratorTest.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math4.ode.nonstiff;
+
+
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.util.Decimal64Field;
+import org.junit.Test;
+
+public class ThreeEighthesFieldIntegratorTest extends 
AbstractRungeKuttaFieldIntegratorTest {
+
+protected > RungeKuttaFieldIntegrator
+createIntegrator(Field field, T step) {
+return new ThreeEighthesFieldIntegrator(field, step);
+}
+
+@Test
+public void testNonFieldIntegratorConsistency() {
+doTestNonFieldIntegratorConsistency(Decimal64Field.getInstance());
+}
+
+@Test
+public void testMissedEndEvent() {
+doTestMissedEndEvent(Decimal64Field.getInstance(), 1.0e-15, 6.0e-5);
+}
+
+@Test
+public void testSanityChecks() {
+doTestSanityChecks(Decimal64Field.getInstance());
+}
+
+@Test
+public void testDecreasingSteps() {
+doTestDecreasingSteps(Decimal64Field.getInstance(), 1.0, 1.0, 1.0e-10);
+}
+
+@Test
+public void testSmallStep() {
+doTestSmallStep(Decimal64Field.getInstance(), 2.0e-13, 4.0e-12, 
1.0e-12, "3/8");
+}
+
+@Test
+public void testBigStep() {
+doTestBigStep(Decimal64Field.getInstance(), 0.0004, 0.005, 1.0e-12, 
"3/8");
+
+}
+
+@Test
+public void testBackward() {
+doTestBackward(Decimal64Field.getInstance(), 5.0e-10, 7.0e-10, 
1.0e-12, "3/8");
+}
+
+@Test
+public void testKepler() {
+doTestKepler(Decimal64Field.getInstance(), 0.0348, 1.0e-4);
+}
+
+@Test
+public void testStepSize() {
+doTestStepSize(Decimal64Field.getInstance(), 1.0e-12);
+}
+
+@Test
+public void testSingleStep() {
+doTestSingleStep(Decimal64Field.getInstance(), 0.21);
+}
+
+@Test
+public void testTooLargeFirstStep() {
+doTestTooLargeFirstStep(Decimal64Field.getInstance());
+}
+
+@Test
+public void testUnstableDerivative() {
+doTestUnstableDerivative(Decimal64Field.getInstance(), 1.0e-12);
+}
+
+@Test
+public void testDerivativesConsistency() {
+doTestDerivativesConsistency(Decimal64Field.getInstance(), 1.0e-10);
+}
+
+}



[01/50] [abbrv] [math] Added tests for derivatives consistency.

2016-01-06 Thread luc
Repository: commons-math
Updated Branches:
  refs/heads/master 7e1c299da -> e76bf903a


Added tests for derivatives consistency.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/de903324
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/de903324
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/de903324

Branch: refs/heads/master
Commit: de903324903d441b3224b2170476629b979d2ad8
Parents: a961a2e
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:06 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:06 2016 +0100

--
 .../AbstractRungeKuttaFieldIntegratorTest.java  | 11 +++
 .../ClassicalRungeKuttaFieldIntegratorTest.java |  5 ++
 .../ode/nonstiff/EulerFieldIntegratorTest.java  |  5 ++
 .../ode/nonstiff/GillFieldIntegratorTest.java   | 82 ++--
 4 files changed, 62 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/de903324/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java
index f670a9f..cc66cd1 100644
--- 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java
@@ -42,6 +42,7 @@ import org.apache.commons.math4.ode.events.Action;
 import org.apache.commons.math4.ode.events.FieldEventHandler;
 import org.apache.commons.math4.ode.sampling.FieldStepHandler;
 import org.apache.commons.math4.ode.sampling.FieldStepInterpolator;
+import org.apache.commons.math4.ode.sampling.StepInterpolatorTestUtils;
 import org.apache.commons.math4.util.FastMath;
 import org.apache.commons.math4.util.MathArrays;
 import org.junit.Assert;
@@ -507,4 +508,14 @@ public abstract class 
AbstractRungeKuttaFieldIntegratorTest {
   Assert.assertEquals(8.0, result.getState()[0].getReal(), epsilon);
 }
 
+@Test
+public abstract void testDerivativesConsistency();
+
+protected > void 
doTestDerivativesConsistency(final Field field, double epsilon) {
+TestFieldProblem3 pb = new TestFieldProblem3(field);
+T step = 
pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.001);
+RungeKuttaFieldIntegrator integ = createIntegrator(field, step);
+StepInterpolatorTestUtils.checkDerivativesConsistency(integ, pb, 
1.0e-10);
+}
+
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/de903324/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldIntegratorTest.java
index 4c3ec47..f2ece27 100644
--- 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldIntegratorTest.java
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldIntegratorTest.java
@@ -91,4 +91,9 @@ public class ClassicalRungeKuttaFieldIntegratorTest extends 
AbstractRungeKuttaFi
 doTestUnstableDerivative(Decimal64Field.getInstance(), 1.0e-12);
 }
 
+@Test
+public void testDerivativesConsistency() {
+doTestDerivativesConsistency(Decimal64Field.getInstance(), 1.0e-10);
+}
+
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/de903324/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerFieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerFieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerFieldIntegratorTest.java
index 76e830a..4d93ca3 100644
--- 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerFieldIntegratorTest.java
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerFieldIntegratorTest.java
@@ -92,4 +92,9 @@ public class EulerFieldIntegratorTest extends 
AbstractRungeKuttaFieldIntegratorT
 doTestUnstableDerivative(Decimal64Field.getInstance(), 1.0e-12);
 }
 
+@Test
+public void testDerivativesConsistency() {
+doTestDerivativesConsistency(Decimal64Field.getInstance(), 1.0e-10);
+}
+
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/de903324/src/test/java/org/apache/commons/

[05/50] [abbrv] [math] Fixed single integration step in step.

2016-01-06 Thread luc
Fixed single integration step in step.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/5246aa05
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/5246aa05
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/5246aa05

Branch: refs/heads/master
Commit: 5246aa0529add36a2fba243dc23a8edb0ff61094
Parents: 548dfd8
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:11 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:11 2016 +0100

--
 ...ractRungeKuttaFieldStepInterpolatorTest.java | 74 +++-
 1 file changed, 41 insertions(+), 33 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/5246aa05/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
index 3e63c34..0ca38aa 100644
--- 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
@@ -95,37 +95,7 @@ public abstract class 
AbstractRungeKuttaFieldStepInterpolatorTest {
 RungeKuttaFieldStepInterpolator interpolator = 
createInterpolator(field, t1 > t0,
  
new FieldExpandableODE(eqn).getMapper());
 // get the Butcher arrays from the field integrator
-String interpolatorName = interpolator.getClass().getName();
-String integratorName = 
interpolatorName.replaceAll("StepInterpolator", "Integrator");
-
-RungeKuttaFieldIntegrator fieldIntegrator = null;
-try {
-@SuppressWarnings("unchecked")
-Class<RungeKuttaFieldIntegrator> clz = 
(Class<RungeKuttaFieldIntegrator>) Class.forName(integratorName);
-try {
-fieldIntegrator = clz.getConstructor(Field.class, 
RealFieldElement.class).newInstance(field,
-   
   field.getOne());
-} catch (NoSuchMethodException nsme) {
-try {
-fieldIntegrator = clz.getConstructor(Field.class, 
RealFieldElement.class,
- 
RealFieldElement.class, RealFieldElement.class).newInstance(field,
-   
  field.getZero().add(0.001),
-   
  field.getOne(),
-   
  field.getOne(),
-   
  field.getOne());
-} catch (NoSuchMethodException e) {
-Assert.fail(e.getLocalizedMessage());
-}
-}
-} catch (InvocationTargetException ite) {
-Assert.fail(ite.getLocalizedMessage());
-} catch (IllegalAccessException iae) {
-Assert.fail(iae.getLocalizedMessage());
-} catch (InstantiationException ie) {
-Assert.fail(ie.getLocalizedMessage());
-} catch (ClassNotFoundException cnfe) {
-Assert.fail(cnfe.getLocalizedMessage());
-}
+RungeKuttaFieldIntegrator fieldIntegrator = 
createFieldIntegrator(field, interpolator);
 T[][] a = fieldIntegrator.getA();
 T[]   b = fieldIntegrator.getB();
 T[]   c = fieldIntegrator.getC();
@@ -146,8 +116,8 @@ public abstract class 
AbstractRungeKuttaFieldStepInterpolatorTest {
 for (int k = 0; k < a.length; ++k) {
 for (int i = 0; i < y0.length; ++i) {
 fieldY[i] = field.getZero().add(y0[i]);
-for (int s = 0; s < k; ++s) {
-fieldY[i] = 
fieldY[i].add(h.multiply(a[s][i].multiply(fieldYDotK[s][i])));
+for (int s = 0; s <= k; ++s) {
+fieldY[i] = 
fieldY[i].add(h.multiply(a[k][s].multiply(fieldYDotK[s][i])));
 }
 }
 fieldYDotK[k + 1] = 
eqn.computeDerivatives(h.multiply(c[k]).add(t0), fieldY);
@@ -169,6 +139,44 @@ public abstract class 

[16/50] [abbrv] [math] Fixed state copying after event detection.

2016-01-06 Thread luc
Fixed state copying after event detection.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/7a5431ec
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/7a5431ec
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/7a5431ec

Branch: refs/heads/master
Commit: 7a5431ecb6efd9ae83c3469f040817d01cdef1c3
Parents: 084ab51
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:25 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:25 2016 +0100

--
 .../math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java| 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/7a5431ec/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java
 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java
index c8de1ad..1f3e87c 100644
--- 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java
+++ 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java
@@ -260,7 +260,8 @@ public abstract class EmbeddedRungeKuttaFieldIntegrator= 0) {
 
 // first stage
-yDotK[0] = stepStart.getDerivative();
+y= equations.getMapper().mapState(stepStart);
+yDotK[0] = equations.getMapper().mapDerivative(stepStart);
 
 if (firstTime) {
 final T[] scale = MathArrays.buildArray(getField(), 
mainSetDimension);
@@ -331,7 +332,6 @@ public abstract class EmbeddedRungeKuttaFieldIntegrator

[02/50] [abbrv] [math] Added tests for midpoint integrator.

2016-01-06 Thread luc
Added tests for midpoint integrator.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/34f1f6a4
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/34f1f6a4
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/34f1f6a4

Branch: refs/heads/master
Commit: 34f1f6a485cf3dbe9270cbf0232cab986ba13cd2
Parents: de90332
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:07 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:07 2016 +0100

--
 .../nonstiff/MidpointFieldIntegratorTest.java   | 99 
 1 file changed, 99 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/34f1f6a4/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldIntegratorTest.java
new file mode 100644
index 000..cc8eb8d
--- /dev/null
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldIntegratorTest.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math4.ode.nonstiff;
+
+
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.util.Decimal64Field;
+import org.junit.Test;
+
+public class MidpointFieldIntegratorTest extends 
AbstractRungeKuttaFieldIntegratorTest {
+
+protected > RungeKuttaFieldIntegrator
+createIntegrator(Field field, T step) {
+return new MidpointFieldIntegrator(field, step);
+}
+
+@Test
+public void testNonFieldIntegratorConsistency() {
+doTestNonFieldIntegratorConsistency(Decimal64Field.getInstance());
+}
+
+@Test
+public void testMissedEndEvent() {
+doTestMissedEndEvent(Decimal64Field.getInstance(), 1.0e-15, 6.0e-5);
+}
+
+@Test
+public void testSanityChecks() {
+doTestSanityChecks(Decimal64Field.getInstance());
+}
+
+@Test
+public void testDecreasingSteps() {
+doTestDecreasingSteps(Decimal64Field.getInstance(), 1.0, 1.0, 1.0e-10);
+}
+
+@Test
+public void testSmallStep() {
+doTestSmallStep(Decimal64Field.getInstance(), 2.0e-7, 1.0e-6, 1.0e-12, 
"midpoint");
+}
+
+@Test
+public void testBigStep() {
+doTestBigStep(Decimal64Field.getInstance(), 0.01, 0.05, 1.0e-12, 
"midpoint");
+
+}
+
+@Test
+public void testBackward() {
+doTestBackward(Decimal64Field.getInstance(), 6.0e-4, 6.0e-4, 1.0e-12, 
"midpoint");
+}
+
+@Test
+public void testKepler() {
+doTestKepler(Decimal64Field.getInstance(), 1.19, 0.01);
+}
+
+@Test
+public void testStepSize() {
+doTestStepSize(Decimal64Field.getInstance(), 1.0e-12);
+}
+
+@Test
+public void testSingleStep() {
+doTestSingleStep(Decimal64Field.getInstance(), 0.21);
+}
+
+@Test
+public void testTooLargeFirstStep() {
+doTestTooLargeFirstStep(Decimal64Field.getInstance());
+}
+
+@Test
+public void testUnstableDerivative() {
+doTestUnstableDerivative(Decimal64Field.getInstance(), 1.0e-12);
+}
+
+@Test
+public void testDerivativesConsistency() {
+doTestDerivativesConsistency(Decimal64Field.getInstance(), 1.0e-10);
+}
+
+}



[04/50] [abbrv] [math] Added test for Luther integrator.

2016-01-06 Thread luc
Added test for Luther integrator.

BEWARE! This test does not work yet. The integrator seems to be wrong
for now, probably at step interpolation level because the Butcher arrays
are consisten with the regulat integrator.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/548dfd8b
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/548dfd8b
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/548dfd8b

Branch: refs/heads/master
Commit: 548dfd8bead389790d1c438d54afaa1f060f0eba
Parents: eef2ed3
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:10 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:10 2016 +0100

--
 .../ode/nonstiff/LutherFieldIntegratorTest.java | 118 +++
 1 file changed, 118 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/548dfd8b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegratorTest.java
new file mode 100644
index 000..3a668b8
--- /dev/null
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegratorTest.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math4.ode.nonstiff;
+
+
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.Decimal64Field;
+import org.junit.Test;
+
+public class LutherFieldIntegratorTest extends 
AbstractRungeKuttaFieldIntegratorTest {
+
+protected > RungeKuttaFieldIntegrator
+createIntegrator(Field field, T step) {
+return new LutherFieldIntegrator(field, step);
+}
+
+@Test
+public void testNonFieldIntegratorConsistency() {
+doTestNonFieldIntegratorConsistency(Decimal64Field.getInstance());
+}
+
+@Test
+public void testMissedEndEvent()
+throws DimensionMismatchException, NumberIsTooSmallException,
+   MaxCountExceededException, NoBracketingException {
+doTestMissedEndEvent(Decimal64Field.getInstance(), 1.0e-15, 1.0e-15);
+}
+
+@Test
+public void testSanityChecks()
+throws DimensionMismatchException, NumberIsTooSmallException,
+   MaxCountExceededException, NoBracketingException {
+doTestSanityChecks(Decimal64Field.getInstance());
+}
+
+@Test
+public void testDecreasingSteps()
+throws DimensionMismatchException, NumberIsTooSmallException,
+   MaxCountExceededException, NoBracketingException {
+doTestDecreasingSteps(Decimal64Field.getInstance(), 1.0, 1.0, 1.0e-10);
+}
+
+@Test
+public void testSmallStep()
+ throws DimensionMismatchException, NumberIsTooSmallException,
+MaxCountExceededException, NoBracketingException {
+doTestSmallStep(Decimal64Field.getInstance(), 9.0e-17, 4.0e-15, 
1.0e-12, "Luther");
+}
+
+@Test
+public void testBigStep()
+throws DimensionMismatchException, NumberIsTooSmallException,
+   MaxCountExceededException, NoBracketingException {
+doTestBigStep(Decimal64Field.getInstance(), 0.2, 0.001, 1.0e-12, 
"Luther");
+}
+
+@Test
+public void testBackward()
+throws DimensionMismatchException, NumberIsTooSmallException,
+   MaxCountExceededException, NoBracketingException {
+doTestBackward(Decimal64Field.getInstance(), 3.0e-13, 5.0e-13, 
1

[06/50] [abbrv] [math] Missing class parameter.

2016-01-06 Thread luc
Missing class parameter.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/272a2550
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/272a2550
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/272a2550

Branch: refs/heads/master
Commit: 272a25500464aeb1a8b45657413cd2f93b7c53c5
Parents: 5246aa0
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:13 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:13 2016 +0100

--
 .../commons/math4/ode/nonstiff/EulerFieldStepInterpolatorTest.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/272a2550/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerFieldStepInterpolatorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerFieldStepInterpolatorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerFieldStepInterpolatorTest.java
index 9b10979..6731827 100644
--- 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerFieldStepInterpolatorTest.java
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerFieldStepInterpolatorTest.java
@@ -28,7 +28,7 @@ public class EulerFieldStepInterpolatorTest extends 
AbstractRungeKuttaFieldStepI
 
 protected > 
RungeKuttaFieldStepInterpolator
 createInterpolator(Field field, boolean forward, 
FieldEquationsMapper mapper) {
-return new EulerFieldStepInterpolator<>(field, forward, mapper);
+return new EulerFieldStepInterpolator(field, forward, mapper);
 }
 
 @Test



[07/50] [abbrv] [math] Added test for classical Rung-Kutta step interpolator.

2016-01-06 Thread luc
Added test for classical Rung-Kutta step interpolator.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/7139af33
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/7139af33
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/7139af33

Branch: refs/heads/master
Commit: 7139af330bcc4cab7c19de4ff75b4d29f1618a56
Parents: 272a255
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:15 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:15 2016 +0100

--
 ...sicalRungKuttaFieldStepInterpolatorTest.java | 44 
 1 file changed, 44 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/7139af33/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungKuttaFieldStepInterpolatorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungKuttaFieldStepInterpolatorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungKuttaFieldStepInterpolatorTest.java
new file mode 100644
index 000..a91c015
--- /dev/null
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungKuttaFieldStepInterpolatorTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math4.ode.nonstiff;
+
+
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.ode.FieldEquationsMapper;
+import org.apache.commons.math4.util.Decimal64Field;
+import org.junit.Test;
+
+public class ClassicalRungKuttaFieldStepInterpolatorTest extends 
AbstractRungeKuttaFieldStepInterpolatorTest {
+
+protected > 
RungeKuttaFieldStepInterpolator
+createInterpolator(Field field, boolean forward, 
FieldEquationsMapper mapper) {
+return new ClassicalRungeKuttaFieldStepInterpolator(field, forward, 
mapper);
+}
+
+@Test
+public void interpolationAtBounds() {
+doInterpolationAtBounds(Decimal64Field.getInstance(), 1.0e-15);
+}
+
+@Test
+public void interpolationInside() {
+doInterpolationInside(Decimal64Field.getInstance(), 2.6e-7, 3.6e-6);
+}
+
+}



[14/50] [abbrv] [math] Fixed a parenthesis error in Higham-Hall 5(4) step interpolator.

2016-01-06 Thread luc
Fixed a parenthesis error in Higham-Hall 5(4) step interpolator.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/9e230797
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/9e230797
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/9e230797

Branch: refs/heads/master
Commit: 9e2307974840d5d20e4a590bbad9fc0514ac425d
Parents: 235a091
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:23 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:23 2016 +0100

--
 .../math4/ode/nonstiff/HighamHall54FieldStepInterpolator.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/9e230797/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldStepInterpolator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldStepInterpolator.java
 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldStepInterpolator.java
index cc1b3c0..c278043 100644
--- 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldStepInterpolator.java
+++ 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldStepInterpolator.java
@@ -84,7 +84,7 @@ class HighamHall54FieldStepInterpolator>
 final T b2 = 
hTheta.multiply(theta.multiply(theta.multiply(theta.multiply(135.0 / 
8.0).add(-243.0 /  8.0)).add(459.0 / 32.0)));
 final T b3 = 
hTheta.multiply(theta.multiply(theta.multiply(theta.multiply(-30.0  ).add( 
152.0 /  3.0)).add(-22.0   )));
 final T b4 = 
hTheta.multiply(theta.multiply(theta.multiply(theta.multiply(125.0 / 
8.0).add(-625.0 / 24.0)).add(375.0 / 32.0)));
-final T b5 = hTheta.multiply(theta.multiply(theta.multiply(
   5.0 / 12.0)).add( -5.0 / 16.0));
+final T b5 = hTheta.multiply(theta.multiply(theta.multiply(
   5.0 / 12.0 ).add( -5.0 / 16.0)));
 interpolatedState   = previousStateLinearCombination(b0, b1, 
b2, b3, b4, b5);
 interpolatedDerivatives = derivativeLinearCombination(bDot0, 
bDot1, bDot2, bDot3, bDot4, bDot5);
 } else {



[10/50] [abbrv] [math] Added test for classical midpoint step interpolator.

2016-01-06 Thread luc
Added test for classical midpoint step interpolator.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/2f8b15ad
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/2f8b15ad
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/2f8b15ad

Branch: refs/heads/master
Commit: 2f8b15ad07b438413f9b8513ed50fd5cf14ceadb
Parents: ba6f4a4
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:18 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:18 2016 +0100

--
 .../MidpointFieldStepInterpolatorTest.java  | 44 
 1 file changed, 44 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/2f8b15ad/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldStepInterpolatorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldStepInterpolatorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldStepInterpolatorTest.java
new file mode 100644
index 000..bb2a335
--- /dev/null
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldStepInterpolatorTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math4.ode.nonstiff;
+
+
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.ode.FieldEquationsMapper;
+import org.apache.commons.math4.util.Decimal64Field;
+import org.junit.Test;
+
+public class MidpointFieldStepInterpolatorTest extends 
AbstractRungeKuttaFieldStepInterpolatorTest {
+
+protected > 
RungeKuttaFieldStepInterpolator
+createInterpolator(Field field, boolean forward, 
FieldEquationsMapper mapper) {
+return new MidpointFieldStepInterpolator(field, forward, mapper);
+}
+
+@Test
+public void interpolationAtBounds() {
+doInterpolationAtBounds(Decimal64Field.getInstance(), 1.0e-15);
+}
+
+@Test
+public void interpolationInside() {
+doInterpolationInside(Decimal64Field.getInstance(), 3.3e-4, 1.1e-5);
+}
+
+}



[18/50] [abbrv] [math] Set up a shared interface for Butcher arrays used by integrators.

2016-01-06 Thread luc
Set up a shared interface for Butcher arrays used by integrators.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/a2718fc3
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/a2718fc3
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/a2718fc3

Branch: refs/heads/master
Commit: a2718fc3a9bc54d5932214b07514446a2fe4c5bf
Parents: 87edfd2
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:27 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:27 2016 +0100

--
 .../ClassicalRungeKuttaFieldIntegrator.java |  6 +--
 .../DormandPrince54FieldIntegrator.java |  6 +--
 .../DormandPrince853FieldIntegrator.java|  6 +--
 .../DormandPrince853FieldStepInterpolator.java  |  2 +-
 .../EmbeddedRungeKuttaFieldIntegrator.java  | 18 +---
 .../ode/nonstiff/EulerFieldIntegrator.java  |  6 +--
 .../ode/nonstiff/FieldButcherArrayProvider.java | 46 
 .../math4/ode/nonstiff/GillFieldIntegrator.java |  6 +--
 .../nonstiff/HighamHall54FieldIntegrator.java   |  6 +--
 .../ode/nonstiff/LutherFieldIntegrator.java |  6 +--
 .../ode/nonstiff/MidpointFieldIntegrator.java   |  6 +--
 .../ode/nonstiff/RungeKuttaFieldIntegrator.java | 18 +---
 .../nonstiff/ThreeEighthesFieldIntegrator.java  |  6 +--
 ...ractRungeKuttaFieldStepInterpolatorTest.java | 28 ++--
 14 files changed, 91 insertions(+), 75 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/a2718fc3/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java
 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java
index 4bb0f61..a09c1fa 100644
--- 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java
+++ 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java
@@ -62,7 +62,7 @@ public class ClassicalRungeKuttaFieldIntegrator>
 
 /** {@inheritDoc} */
 @Override
-protected T[] getC() {
+public T[] getC() {
 final T[] c = MathArrays.buildArray(getField(), 3);
 c[0] = getField().getOne().multiply(0.5);
 c[1] = c[0];
@@ -72,7 +72,7 @@ public class ClassicalRungeKuttaFieldIntegrator>
 
 /** {@inheritDoc} */
 @Override
-protected T[][] getA() {
+public T[][] getA() {
 final T[][] a = MathArrays.buildArray(getField(), 3, -1);
 for (int i = 0; i < a.length; ++i) {
 a[i] = MathArrays.buildArray(getField(), i + 1);
@@ -88,7 +88,7 @@ public class ClassicalRungeKuttaFieldIntegrator>
 
 /** {@inheritDoc} */
 @Override
-protected T[] getB() {
+public T[] getB() {
 final T[] b = MathArrays.buildArray(getField(), 4);
 b[0] = fraction(1, 6);
 b[1] = fraction(1, 3);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a2718fc3/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegrator.java
 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegrator.java
index a12453d..743dbe4 100644
--- 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegrator.java
+++ 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegrator.java
@@ -130,7 +130,7 @@ public class DormandPrince54FieldIntegrator>
 
 /** {@inheritDoc} */
 @Override
-protected T[] getC() {
+public T[] getC() {
 final T[] c = MathArrays.buildArray(getField(), 6);
 c[0] = fraction(1,  5);
 c[1] = fraction(3, 10);
@@ -143,7 +143,7 @@ public class DormandPrince54FieldIntegrator>
 
 /** {@inheritDoc} */
 @Override
-protected T[][] getA() {
+public T[][] getA() {
 final T[][] a = MathArrays.buildArray(getField(), 6, -1);
 for (int i = 0; i < a.length; ++i) {
 a[i] = MathArrays.buildArray(getField(), i + 1);
@@ -174,7 +174,7 @@ public class DormandPrince54FieldIntegrator>
 
 /** {@inheritDoc} */
 @Override
-protected T[] getB() {
+public T[] getB() {
 final T[] b = MathArrays.buildArray(getField(), 7);
 b[0] = fraction(   35,   384);
 b[1] = getField().getZero();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a2718fc3/src/main/java/org/apache/commons/math4/ode/nonstiff/

[47/50] [abbrv] [math] Javadoc.

2016-01-06 Thread luc
Javadoc.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/f0a39a86
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/f0a39a86
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/f0a39a86

Branch: refs/heads/master
Commit: f0a39a86864410beb84cf8898ea70f9fab7420e0
Parents: 8361fd7
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 14:20:29 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 14:20:29 2016 +0100

--
 .../commons/math4/geometry/euclidean/threed/FieldRotation.java   | 4 ++--
 .../apache/commons/math4/ode/nonstiff/AdamsFieldIntegrator.java  | 2 +-
 .../math4/ode/nonstiff/AdamsNordsieckFieldTransformer.java   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/f0a39a86/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotation.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotation.java
 
b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotation.java
index 4c7c888..2dc6933 100644
--- 
a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotation.java
+++ 
b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotation.java
@@ -112,7 +112,7 @@ public class FieldRotation> 
implements Serializabl
  * @param angle rotation angle.
  * @exception MathIllegalArgumentException if the axis norm is zero
  * @deprecated as of 3.6, replaced with {@link
- * #FieldRotation(FieldVector3D, RealFieldElement, RotationConvention)
+ * #FieldRotation(FieldVector3D, RealFieldElement, RotationConvention)}
  */
 @Deprecated
 public FieldRotation(final FieldVector3D axis, final T angle)
@@ -1401,7 +1401,7 @@ public class FieldRotation> 
implements Serializabl
 /** Apply the inverse of the instance to another rotation.
  * 
  * Calling this method is equivalent to call
- * {@link #composeInverse(FieldRotation, RotationConvention)
+ * {@link #composeInverse(FieldRotation, RotationConvention)
  * composeInverse(r, RotationConvention.VECTOR_OPERATOR)}.
  * 
  * @param r rotation to apply the rotation to

http://git-wip-us.apache.org/repos/asf/commons-math/blob/f0a39a86/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsFieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsFieldIntegrator.java 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsFieldIntegrator.java
index 9039ca1..cb2061b 100644
--- 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsFieldIntegrator.java
+++ 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsFieldIntegrator.java
@@ -119,7 +119,7 @@ public abstract class AdamsFieldIntegrator> extend
  * @param highOrder high order scaled derivatives
  * (h2/2 y'', ... hk/k! y(k))
  * @return updated high order derivatives
- * @see #updateHighOrderDerivativesPhase2(double[], double[], 
Array2DRowFieldMatrix)
+ * @see #updateHighOrderDerivativesPhase2(RealFieldElement[], 
RealFieldElement[], Array2DRowFieldMatrix)
  */
 public Array2DRowFieldMatrix updateHighOrderDerivativesPhase1(final 
Array2DRowFieldMatrix highOrder) {
 return transformer.updateHighOrderDerivativesPhase1(highOrder);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/f0a39a86/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsNordsieckFieldTransformer.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsNordsieckFieldTransformer.java
 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsNordsieckFieldTransformer.java
index 93ec85e..c1e5bee 100644
--- 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsNordsieckFieldTransformer.java
+++ 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsNordsieckFieldTransformer.java
@@ -327,7 +327,7 @@ public class AdamsNordsieckFieldTransformer> {
  * @param highOrder high order scaled derivatives
  * (h2/2 y'', ... hk/k! y(k))
  * @return updated high order derivatives
- * @see #updateHighOrderDerivativesPhase2(double[], double[], 
Array2DRowFieldMatrix)
+ * @see #updateHighOrderDerivativesPhase2(RealFieldElement[], 
RealFieldElement[], Array2DRowFieldMatrix)
  */
 public Array2DRowFieldMatrix updateHighOrderDerivativesPhase1(final 
Array2DRowFieldMatrix highOrder) {
 return update.multiply(highOrder);



[21/50] [abbrv] [math] Added tests for the Dormand-Prince 5(4) integrator.

2016-01-06 Thread luc
Added tests for the Dormand-Prince 5(4) integrator.

BEWARE! These test do not pass yet. The integrator is currently not
consistent with the regular double-based integrator.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/2e4b80f8
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/2e4b80f8
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/2e4b80f8

Branch: refs/heads/master
Commit: 2e4b80f86606e8ee3e363ad4860afdd50503374c
Parents: 7fc003d
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:33 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:33 2016 +0100

--
 .../DormandPrince54FieldIntegratorTest.java | 93 
 ...ormandPrince54FieldStepInterpolatorTest.java | 49 +++
 2 files changed, 142 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/2e4b80f8/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
new file mode 100644
index 000..4015ffe
--- /dev/null
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math4.ode.nonstiff;
+
+
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.util.Decimal64Field;
+import org.junit.Test;
+
+public class DormandPrince54FieldIntegratorTest extends 
AbstractEmbeddedRungeKuttaFieldIntegratorTest {
+
+protected > 
EmbeddedRungeKuttaFieldIntegrator
+createIntegrator(Field field, final double minStep, final double 
maxStep,
+ final double scalAbsoluteTolerance, final double 
scalRelativeTolerance) {
+return new DormandPrince54FieldIntegrator(field, minStep, maxStep, 
scalAbsoluteTolerance, scalRelativeTolerance);
+}
+
+protected > 
EmbeddedRungeKuttaFieldIntegrator
+createIntegrator(Field field, final double minStep, final double 
maxStep,
+ final double[] vecAbsoluteTolerance, final double[] 
vecRelativeTolerance) {
+return new DormandPrince54FieldIntegrator(field, minStep, maxStep, 
vecAbsoluteTolerance, vecRelativeTolerance);
+}
+
+@Test
+public void testNonFieldIntegratorConsistency() {
+doTestNonFieldIntegratorConsistency(Decimal64Field.getInstance());
+}
+
+@Test
+public void testSanityChecks() {
+doTestSanityChecks(Decimal64Field.getInstance());
+}
+
+@Test
+public void testBackward() {
+doTestBackward(Decimal64Field.getInstance(), 2.0e-7, 2.0e-7, 1.0e-12, 
"Dormand-Prince 5(4)");
+}
+
+@Test
+public void testKepler() {
+doTestKepler(Decimal64Field.getInstance(), 7.0e-10);
+}
+
+@Override
+public void testForwardBackwardExceptions() {
+doTestForwardBackwardExceptions(Decimal64Field.getInstance());
+}
+
+@Override
+public void testMinStep() {
+doTestMinStep(Decimal64Field.getInstance());
+}
+
+@Override
+public void testIncreasingTolerance() {
+// the 0.7 factor is only valid for this test
+// and has been obtained from trial and error
+// there is no general relation between local and global errors
+doTestIncreasingTolerance(Decimal64Field.getInstance(), 0.7, 1.0e-12);
+}
+
+@Override
+public void testEvents() {
+doTestEvents(Decimal64Field.getInstance(), 5.0e-6, "Dormand-Prince 
5(4)");
+}
+
+@Override
+public void testEventsErrors() {
+doTestEventsErrors(Decimal64Field.getInstance());
+}

[42/50] [abbrv] [math] Base classes for field-based multistep integrators.

2016-01-06 Thread luc
Base classes for field-based multistep integrators.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/dd9dc945
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/dd9dc945
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/dd9dc945

Branch: refs/heads/master
Commit: dd9dc9457722787992347ae54d9a8fe8d4b91d2e
Parents: 2a49849
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 14:18:26 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 14:18:26 2016 +0100

--
 .../math4/ode/MultistepFieldIntegrator.java | 427 +++
 .../ode/nonstiff/AdamsFieldIntegrator.java  | 146 +++
 .../nonstiff/AdamsFieldStepInterpolator.java| 193 +
 .../AdamsNordsieckFieldTransformer.java | 362 
 .../AbstractAdamsFieldIntegratorTest.java   | 261 
 5 files changed, 1389 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/dd9dc945/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java 
b/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java
new file mode 100644
index 000..feec974
--- /dev/null
+++ b/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java
@@ -0,0 +1,427 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math4.ode;
+
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.linear.Array2DRowFieldMatrix;
+import org.apache.commons.math4.ode.nonstiff.AdaptiveStepsizeFieldIntegrator;
+import org.apache.commons.math4.ode.nonstiff.DormandPrince853FieldIntegrator;
+import org.apache.commons.math4.ode.sampling.FieldStepHandler;
+import org.apache.commons.math4.ode.sampling.FieldStepInterpolator;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MathUtils;
+
+/**
+ * This class is the base class for multistep integrators for Ordinary
+ * Differential Equations.
+ * We define scaled derivatives si(n) at step n as:
+ * 
+ * s1(n) = h y'n for first derivative
+ * s2(n) = h2/2 y''n for second derivative
+ * s3(n) = h3/6 y'''n for third derivative
+ * ...
+ * sk(n) = hk/k! y(k)n for 
kth derivative
+ * 
+ * Rather than storing several previous steps separately, this 
implementation uses
+ * the Nordsieck vector with higher degrees scaled derivatives all taken at 
the same
+ * step (yn, s1(n) and rn) where 
rn is defined as:
+ * 
+ * rn = [ s2(n), s3(n) ... sk(n) 
]T
+ * 
+ * (we omit the k index in the notation for clarity)
+ * 
+ * Multistep integrators with Nordsieck representation are highly sensitive to
+ * large step changes because when the step is multiplied by factor a, the
+ * kth component of the Nordsieck vector is multiplied by 
ak
+ * and the last components are the least accurate ones. The default max growth
+ * factor is therefore set to a quite low value: 21/order.
+ * 
+ *
+ * @see org.apache.commons.math4.ode.nonstiff.AdamsBashforthFieldIntegrator
+ * @see org.apache.commons.math4.ode.nonstiff.AdamsMoultonFieldIntegrator
+ * @param  the type of the field elements
+ * @since 3.6
+ */
+public abstract class MultistepFieldIntegrator>
+extends AdaptiveStepsizeFieldIntegrator {
+
+/** First scaled derivative (h y'). */
+protected T[] scaled;
+
+/** No

[37/50] [abbrv] [math] Fixed test as the master brnahc generates different exceptions.

2016-01-06 Thread luc
Fixed test as the master brnahc generates different exceptions.

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/6e4265d6
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/6e4265d6
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/6e4265d6

Branch: refs/heads/master
Commit: 6e4265d61c22aa0a5b627e8bb4814fff382a7170
Parents: a2efc6b
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 13:39:56 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 13:39:56 2016 +0100

--
 .../commons/math4/ode/ContinuousOutputFieldModelTest.java  | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/6e4265d6/src/test/java/org/apache/commons/math4/ode/ContinuousOutputFieldModelTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/ContinuousOutputFieldModelTest.java
 
b/src/test/java/org/apache/commons/math4/ode/ContinuousOutputFieldModelTest.java
index f7bbe5c..fd87aba 100644
--- 
a/src/test/java/org/apache/commons/math4/ode/ContinuousOutputFieldModelTest.java
+++ 
b/src/test/java/org/apache/commons/math4/ode/ContinuousOutputFieldModelTest.java
@@ -21,6 +21,8 @@ import java.util.Random;
 
 import org.apache.commons.math4.Field;
 import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
 import org.apache.commons.math4.ode.nonstiff.DormandPrince54FieldIntegrator;
 import org.apache.commons.math4.ode.nonstiff.DormandPrince853FieldIntegrator;
 import org.apache.commons.math4.ode.sampling.DummyFieldStepInterpolator;
@@ -185,7 +187,9 @@ public class ContinuousOutputFieldModelTest {
 ContinuousOutputFieldModel otherCm = new 
ContinuousOutputFieldModel();
 otherCm.handleStep(buildInterpolator(field, t0, t1, y), true);
 cm.append(otherCm);
-} catch(IllegalArgumentException iae) {
+} catch(DimensionMismatchException dme) {
+return true; // there was an allowable error
+} catch(MathIllegalArgumentException miae) {
 return true; // there was an allowable error
 }
 return false; // no allowable error



[24/50] [abbrv] [math] Fixed field-based Dormand-Prince 8(5, 3) integrator constants.

2016-01-06 Thread luc
Fixed field-based Dormand-Prince 8(5,3) integrator constants.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/60afd02a
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/60afd02a
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/60afd02a

Branch: refs/heads/master
Commit: 60afd02a508bf721734eba66d1ddf412fb6d0970
Parents: 53af147
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:37 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:37 2016 +0100

--
 .../DormandPrince853FieldIntegrator.java| 54 ++--
 1 file changed, 27 insertions(+), 27 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/60afd02a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldIntegrator.java
 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldIntegrator.java
index 6c754d7..9f8e36c 100644
--- 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldIntegrator.java
+++ 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldIntegrator.java
@@ -230,7 +230,7 @@ public class DormandPrince853FieldIntegrator>
 a[ 0][ 0] = sqrt6.add(-6).divide(-67.5);
 
 a[ 1][ 0] = sqrt6.add(-6).divide(-180);
-a[ 1][ 1] = sqrt6.add(-6).divide( -40);
+a[ 1][ 1] = sqrt6.add(-6).divide( -60);
 
 a[ 2][ 0] = sqrt6.add(-6).divide(-120);
 a[ 2][ 1] = getField().getZero();
@@ -259,7 +259,7 @@ public class DormandPrince853FieldIntegrator>
 a[ 6][ 2] = getField().getZero();
 a[ 6][ 3] = sqrt6.multiply( 4784).add(51544).divide(371293);
 a[ 6][ 4] = sqrt6.multiply(-4784).add(51544).divide(371293);
-a[ 6][ 5] = fraction(-5688, 371283);
+a[ 6][ 5] = fraction(-5688, 371293);
 a[ 6][ 6] = fraction( 3072, 371293);
 
 a[ 7][ 0] = fraction(58656157643.0, 93983540625.0);
@@ -320,47 +320,47 @@ public class DormandPrince853FieldIntegrator>
 a[11][11] = fraction(137909.0, 3084480.0);
 
 // the following stages are for interpolation only
-a[12][ 0] = fraction(  13481885573.0, 24003000.0) 
.subtract(a[11][0]);
+a[12][ 0] = fraction(  13481885573.0, 24003000.0);
 a[12][ 1] = getField().getZero();
 a[12][ 2] = getField().getZero();
 a[12][ 3] = getField().getZero();
 a[12][ 4] = getField().getZero();
-a[12][ 5] = getField().getZero()  
.subtract(a[11][5]);
-a[12][ 6] = fraction( 139418837528.0, 549975234375.0) 
.subtract(a[11][6]);
-a[12][ 7] = fraction(  -11108320068443.0, 4511193750.0)   
.subtract(a[11][7]);
-a[12][ 8] = fraction(-1769651421925959.0, 
1424938514608.0).subtract(a[11][8]);
-a[12][ 9] = fraction( 57799439.0, 377055000.0)
.subtract(a[11][9]);
-a[12][10] = fraction( 793322643029.0, 9673425000.0)   
.subtract(a[11][10]);
-a[12][11] = fraction(   1458939311.0, 19278000.0) 
.subtract(a[11][11]);
+a[12][ 5] = getField().getZero();
+a[12][ 6] = fraction( 139418837528.0, 549975234375.0);
+a[12][ 7] = fraction(  -11108320068443.0, 4511193750.0);
+a[12][ 8] = fraction(-1769651421925959.0, 1424938514608.0);
+a[12][ 9] = fraction( 57799439.0, 377055000.0);
+a[12][10] = fraction( 793322643029.0, 9673425000.0);
+a[12][11] = fraction(   1458939311.0, 19278000.0);
 a[12][12]  = fraction(-4149.0, 50.0);
 
-a[13][ 0] = fraction(1595561272731.0, 5012027350.0)   
.subtract(a[11][0]);
+a[13][ 0] = fraction(1595561272731.0, 5012027350.0);
 a[13][ 1] = getField().getZero();
 a[13][ 2] = getField().getZero();
 a[13][ 3] = getField().getZero();
 a[13][ 4] = getField().getZero();
-a[13][ 5] = fraction( 975183916491.0, 34457688031250.0)   
.subtract(a[11][5]);
-a[13][ 6] = fraction(   38492013932672.0, 718912673015625.0)  
.subtract(a[11][6]);
-a[13][ 7] = fraction(-1114881286517557.0, 
2029871076750.0).subtract(a[11][7]);
-a[13][ 8] = getField().getZero()  
.subtract(a[11][8]);
-a[13][ 9] = getField().getZero()  
.subtract(a[11][9]);
-a[13][10] = fraction(   -2538710946863.0, 
2343122786125.0).subtract(a[11][10]);
-a[13][11] = fraction(   8824659001.0, 230667167

[32/50] [abbrv] [math] Use immutable step interpolators.

2016-01-06 Thread luc
Use immutable step interpolators.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/771eb6a6
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/771eb6a6
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/771eb6a6

Branch: refs/heads/master
Commit: 771eb6a606491375a61fee1aa537025edafacc34
Parents: 0ddec29
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 13:22:39 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 13:22:39 2016 +0100

--
 .../math4/ode/AbstractFieldIntegrator.java  |  15 +-
 .../math4/ode/ContinuousOutputFieldModel.java   |   6 +-
 .../ClassicalRungeKuttaFieldIntegrator.java |  11 +-
 ...lassicalRungeKuttaFieldStepInterpolator.java |  42 ++--
 .../DormandPrince54FieldIntegrator.java |  10 +-
 .../DormandPrince54FieldStepInterpolator.java   |  64 +++---
 .../DormandPrince853FieldIntegrator.java|  10 +-
 .../DormandPrince853FieldStepInterpolator.java  | 227 ++-
 .../EmbeddedRungeKuttaFieldIntegrator.java  |  22 +-
 .../ode/nonstiff/EulerFieldIntegrator.java  |  11 +-
 .../nonstiff/EulerFieldStepInterpolator.java|  46 ++--
 .../math4/ode/nonstiff/GillFieldIntegrator.java |  11 +-
 .../ode/nonstiff/GillFieldStepInterpolator.java |  45 ++--
 .../nonstiff/HighamHall54FieldIntegrator.java   |  10 +-
 .../HighamHall54FieldStepInterpolator.java  |  59 +++--
 .../ode/nonstiff/LutherFieldIntegrator.java |  11 +-
 .../nonstiff/LutherFieldStepInterpolator.java   |  62 +++--
 .../ode/nonstiff/MidpointFieldIntegrator.java   |  11 +-
 .../nonstiff/MidpointFieldStepInterpolator.java |  47 ++--
 .../ode/nonstiff/RungeKuttaFieldIntegrator.java |  22 +-
 .../RungeKuttaFieldStepInterpolator.java|  79 ---
 .../nonstiff/ThreeEighthesFieldIntegrator.java  |  11 +-
 .../ThreeEighthesFieldStepInterpolator.java |  41 ++--
 .../sampling/AbstractFieldStepInterpolator.java | 145 +---
 .../ode/sampling/FieldStepInterpolator.java |  11 -
 .../ode/ContinuousOutputFieldModelTest.java | 219 ++
 ...ractRungeKuttaFieldStepInterpolatorTest.java |  71 ++
 ...sicalRungKuttaFieldStepInterpolatorTest.java |  20 +-
 ...ormandPrince54FieldStepInterpolatorTest.java |  20 +-
 ...rmandPrince853FieldStepInterpolatorTest.java |  18 +-
 .../EulerFieldStepInterpolatorTest.java |  19 +-
 .../nonstiff/GillFieldStepInterpolatorTest.java |  20 +-
 .../HighamHall54FieldStepInterpolatorTest.java  |  20 +-
 .../LutherFieldStepInterpolatorTest.java|  18 +-
 .../MidpointFieldStepInterpolatorTest.java  |  20 +-
 .../ThreeEighthesFieldStepInterpolatorTest.java |  20 +-
 .../sampling/DummyFieldStepInterpolator.java|  55 +
 37 files changed, 981 insertions(+), 568 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/771eb6a6/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java 
b/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
index 07fa9a0..b4f321c 100644
--- a/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
@@ -307,6 +307,7 @@ public abstract class AbstractFieldIntegrator> imp
 }
 }
 
+AbstractFieldStepInterpolator restricted = interpolator;
 while (!occurringEvents.isEmpty()) {
 
 // handle the chronologically first event
@@ -315,11 +316,10 @@ public abstract class AbstractFieldIntegrator> imp
 iterator.remove();
 
 // get state at event time
-final FieldODEStateAndDerivative eventState = 
interpolator.getInterpolatedState(currentEvent.getEventTime());
+final FieldODEStateAndDerivative eventState = 
restricted.getInterpolatedState(currentEvent.getEventTime());
 
 // restrict the interpolator to the first part of the step, up 
to the event
-interpolator.setSoftPreviousState(previousState);
-interpolator.setSoftCurrentState(eventState);
+restricted = restricted.restrictStep(previousState, 
eventState);
 
 // advance all event states to current time
 for (final FieldEventState state : eventsStates) {
@@ -329,7 +329,7 @@ public abstract class AbstractFieldIntegrator> imp
 
 // handle the first part of the step, up to the event
 for (final FieldStepHandler handler : stepHandlers) {
-handler.handleStep(int

[33/50] [abbrv] [math] fixed Javadoc.

2016-01-06 Thread luc
fixed Javadoc.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/5672ebe9
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/5672ebe9
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/5672ebe9

Branch: refs/heads/master
Commit: 5672ebe9123cd0c97524f95bcce6d8d634142cc8
Parents: 771eb6a
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 13:29:26 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 13:29:26 2016 +0100

--
 .../apache/commons/math4/ode/AbstractFieldIntegrator.java   | 4 ++--
 .../commons/math4/ode/ContinuousOutputFieldModel.java   | 9 -
 .../apache/commons/math4/ode/FieldFirstOrderIntegrator.java | 2 +-
 .../java/org/apache/commons/math4/ode/FieldODEState.java| 2 +-
 .../commons/math4/ode/FieldODEStateAndDerivative.java   | 2 +-
 .../math4/ode/nonstiff/AdaptiveStepsizeFieldIntegrator.java | 4 ++--
 .../math4/ode/nonstiff/ThreeEighthesFieldIntegrator.java| 2 +-
 7 files changed, 12 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/5672ebe9/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java 
b/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
index b4f321c..81f4085 100644
--- a/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
@@ -246,8 +246,8 @@ public abstract class AbstractFieldIntegrator> imp
  * @exception DimensionMismatchException if arrays dimensions do not match 
equations settings
  * @exception MaxCountExceededException if the number of functions 
evaluations is exceeded
  * @exception NullPointerException if the ODE equations have not been set 
(i.e. if this method
- * is called outside of a call to {@link #integrate(ExpandableStatefulODE, 
double)} or {@link
- * #integrate(FirstOrderDifferentialEquations, double, double[], double, 
double[])})
+ * is called outside of a call to {@link #integrate(FieldExpandableODE, 
FieldODEState,
+ * RealFieldElement) integrate}
  */
 public T[] computeDerivatives(final T t, final T[] y)
 throws DimensionMismatchException, MaxCountExceededException, 
NullPointerException {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/5672ebe9/src/main/java/org/apache/commons/math4/ode/ContinuousOutputFieldModel.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/ContinuousOutputFieldModel.java 
b/src/main/java/org/apache/commons/math4/ode/ContinuousOutputFieldModel.java
index f26fded..e9a1a29 100644
--- a/src/main/java/org/apache/commons/math4/ode/ContinuousOutputFieldModel.java
+++ b/src/main/java/org/apache/commons/math4/ode/ContinuousOutputFieldModel.java
@@ -38,11 +38,10 @@ import org.apache.commons.math4.util.FastMath;
  * view. It is called iteratively during the integration process and
  * stores a copy of all steps information in a sorted collection for
  * later use. Once the integration process is over, the user can use
- * the {@link #setInterpolatedTime setInterpolatedTime} and {@link
- * #getInterpolatedState getInterpolatedState} to retrieve this
- * information at any time. It is important to wait for the
- * integration to be over before attempting to call {@link
- * #setInterpolatedTime setInterpolatedTime} because some internal
+ * the {@link #getInterpolatedState(RealFieldElement) getInterpolatedState}
+ * method to retrieve this information at any time. It is important to wait
+ * for the integration to be over before attempting to call {@link
+ * #getInterpolatedState(RealFieldElement)} because some internal
  * variables are set only once the last step has been handled.
  *
  * This is useful for example if the main loop of the user

http://git-wip-us.apache.org/repos/asf/commons-math/blob/5672ebe9/src/main/java/org/apache/commons/math4/ode/FieldFirstOrderIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/FieldFirstOrderIntegrator.java 
b/src/main/java/org/apache/commons/math4/ode/FieldFirstOrderIntegrator.java
index 2ab6831..981d22b 100644
--- a/src/main/java/org/apache/commons/math4/ode/FieldFirstOrderIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/FieldFirstOrderIntegrator.java
@@ -82,7 +82,7 @@ public interface FieldFirstOrderIntegrator> {
  * @param maxIterationCount upper limit of the iteration count in
  * the event time search ev

[49/50] [abbrv] [math] Renamed abstract test classes to match build environment filters.

2016-01-06 Thread luc
Renamed abstract test classes to match build environment filters.

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/9d47e0f9
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/9d47e0f9
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/9d47e0f9

Branch: refs/heads/master
Commit: 9d47e0f911981bee44146aa40ade3571f64e2d3f
Parents: f0a39a8
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 14:27:52 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 14:27:52 2016 +0100

--
 .../AbstractAdamsFieldIntegratorTest.java   | 260 
 ...ractRungeKuttaFieldStepInterpolatorTest.java | 305 -
 .../AdamsBashforthFieldIntegratorTest.java  |   2 +-
 .../AdamsFieldIntegratorAbstractTest.java   | 260 
 .../AdamsMoultonFieldIntegratorTest.java|   2 +-
 ...sicalRungKuttaFieldStepInterpolatorTest.java |   2 +-
 .../ClassicalRungeKuttaFieldIntegratorTest.java |   2 +-
 .../DormandPrince54FieldIntegratorTest.java |   2 +-
 ...ormandPrince54FieldStepInterpolatorTest.java |   2 +-
 .../DormandPrince853FieldIntegratorTest.java|   2 +-
 ...rmandPrince853FieldStepInterpolatorTest.java |   2 +-
 ...edRungeKuttaFieldIntegratorAbstractTest.java | 600 +
 .../ode/nonstiff/EulerFieldIntegratorTest.java  |   2 +-
 .../EulerFieldStepInterpolatorTest.java |   2 +-
 .../ode/nonstiff/GillFieldIntegratorTest.java   |   2 +-
 .../nonstiff/GillFieldStepInterpolatorTest.java |   2 +-
 .../HighamHall54FieldIntegratorTest.java|   2 +-
 .../HighamHall54FieldStepInterpolatorTest.java  |   2 +-
 .../ode/nonstiff/LutherFieldIntegratorTest.java |   2 +-
 .../LutherFieldStepInterpolatorTest.java|   2 +-
 .../nonstiff/MidpointFieldIntegratorTest.java   |   2 +-
 .../MidpointFieldStepInterpolatorTest.java  |   2 +-
 .../RungeKuttaFieldIntegratorAbstractTest.java  | 662 +++
 ...eKuttaFieldStepInterpolatorAbstractTest.java | 305 +
 .../ThreeEighthesFieldIntegratorTest.java   |   2 +-
 .../ThreeEighthesFieldStepInterpolatorTest.java |   2 +-
 26 files changed, 1847 insertions(+), 585 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/9d47e0f9/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractAdamsFieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractAdamsFieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractAdamsFieldIntegratorTest.java
deleted file mode 100644
index 606c9e8..000
--- 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractAdamsFieldIntegratorTest.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.math4.ode.nonstiff;
-
-
-import org.apache.commons.math4.Field;
-import org.apache.commons.math4.RealFieldElement;
-import org.apache.commons.math4.exception.MathIllegalStateException;
-import org.apache.commons.math4.exception.MaxCountExceededException;
-import org.apache.commons.math4.exception.NumberIsTooSmallException;
-import org.apache.commons.math4.ode.AbstractFieldIntegrator;
-import org.apache.commons.math4.ode.FieldExpandableODE;
-import org.apache.commons.math4.ode.FieldODEState;
-import org.apache.commons.math4.ode.FieldODEStateAndDerivative;
-import org.apache.commons.math4.ode.FirstOrderFieldIntegrator;
-import org.apache.commons.math4.ode.MultistepFieldIntegrator;
-import org.apache.commons.math4.ode.TestFieldProblem1;
-import org.apache.commons.math4.ode.TestFieldProblem5;
-import org.apache.commons.math4.ode.TestFieldProblem6;
-import org.apache.commons.math4.ode.TestFieldProblemAbstract;
-import org.apache.commons.math4.ode.TestFieldProblemHandler;
-import org.apache.commons.math4.ode.sampling.FieldStepHandler;
-import org.apache.commons.math4.ode.sampling.FieldStepInterpolator;
-import org.apache.comm

[25/50] [abbrv] [math] Fixed test thresholds.

2016-01-06 Thread luc
Fixed test thresholds.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/73b76598
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/73b76598
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/73b76598

Branch: refs/heads/master
Commit: 73b76598e776bbe7962e18cea087bdca1d560769
Parents: 60afd02
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:38 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:38 2016 +0100

--
 .../math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/73b76598/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
index 9a853cd..d25c4ad 100644
--- 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
@@ -69,15 +69,15 @@ public class DormandPrince54FieldIntegratorTest extends 
AbstractEmbeddedRungeKut
 
 @Override
 public void testIncreasingTolerance() {
-// the 0.5 factor is only valid for this test
+// the 0.7 factor is only valid for this test
 // and has been obtained from trial and error
 // there is no general relation between local and global errors
-doTestIncreasingTolerance(Decimal64Field.getInstance(), 0.5, 1.0e-12);
+doTestIncreasingTolerance(Decimal64Field.getInstance(), 0.7, 1.0e-12);
 }
 
 @Override
 public void testEvents() {
-doTestEvents(Decimal64Field.getInstance(), 3.10e-8, "Dormand-Prince 
5(4)");
+doTestEvents(Decimal64Field.getInstance(), 1.7e-7, "Dormand-Prince 
5(4)");
 }
 
 @Override



[29/50] [abbrv] [math] Notify availability of field-based ode.

2016-01-06 Thread luc
Notify availability of field-based ode.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/c246b37d
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/c246b37d
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/c246b37d

Branch: refs/heads/master
Commit: c246b37dbe38b16ded570b2280af8f21fb95618a
Parents: 11df45b
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 13:20:25 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 13:20:25 2016 +0100

--
 src/site/xdoc/userguide/ode.xml | 20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/c246b37d/src/site/xdoc/userguide/ode.xml
--
diff --git a/src/site/xdoc/userguide/ode.xml b/src/site/xdoc/userguide/ode.xml
index b2fe395..3dc48bc 100644
--- a/src/site/xdoc/userguide/ode.xml
+++ b/src/site/xdoc/userguide/ode.xml
@@ -69,11 +69,27 @@
   derivatives being handled be secondary ODE (see below for an 
example).
 
 
+ Two parallel APIs are available. The first is devoted to solve ode 
for which the integration free
+ variable t and the state y(t) are primitive double and primitive 
double array respectively. Starting
+ with version 3.6, a second API is devoted to solve ode for which the 
integration free
+ variable t and the state y(t) are RealFieldElement and 
RealFieldElement
+ array respectively. This allow for example users to integrate ode 
where the computation values
+ are for example DerivativeStructure elements, hence 
automatically computing
+ partial derivatives with respect to some equations parameters without 
a need to set up the
+ variational equations. Another example is to use Dfp 
elements in order to solve
+ ode with extended precision. As of 3.6, the API are slightly 
different, mainly in the way they
+ handle arrays. Both API will become more similar in 4.0 and future 
versions as the older
+ primitive double API will be modified to match the newer field API. 
This cannot be done in
+ 3.6 for compatibility reasons.
+
+
   The user should describe his problem in his own classes which should 
implement the
   FirstOrderDifferentialEquations
-  interface. Then he should pass it to the integrator he prefers among 
all the classes that implement
+  interface (or  FieldFirstOrderDifferentialEquations
+  interface). Then he should pass it to the integrator he prefers 
among all the classes that implement
   the FirstOrderIntegrator
-  interface. The following example shows how to implement the simple 
two-dimensional problem:
+  interface (or the FieldFirstOrderIntegrator
+  interface). The following example shows how to implement the simple 
two-dimensional problem using double primitives:
   
 y'0(t) =   (c1 - 
y1(t))
 y'1(t) =   (y0(t) - 
c0)



[46/50] [abbrv] [math] updated copyright year

2016-01-06 Thread luc
updated copyright year


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/8361fd7f
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/8361fd7f
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/8361fd7f

Branch: refs/heads/master
Commit: 8361fd7f9c9af12136185a45d4d104ef0334db91
Parents: 82cf277
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 14:20:00 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 14:20:00 2016 +0100

--
 NOTICE.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/8361fd7f/NOTICE.txt
--
diff --git a/NOTICE.txt b/NOTICE.txt
index ce791e4..be158fe 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -1,5 +1,5 @@
 Apache Commons Math
-Copyright 2001-2015 The Apache Software Foundation
+Copyright 2001-2016 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).



[36/50] [abbrv] [math] Added tests with DerivativeStructure field.

2016-01-06 Thread luc
Added tests with DerivativeStructure field.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/a2efc6b6
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/a2efc6b6
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/a2efc6b6

Branch: refs/heads/master
Commit: a2efc6b6b998a511666079b6d4c63ac38f215648
Parents: 1d4d89e
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 13:30:34 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 13:30:34 2016 +0100

--
 ...ctEmbeddedRungeKuttaFieldIntegratorTest.java | 141 +++
 .../AbstractRungeKuttaFieldIntegratorTest.java  | 141 +++
 .../ClassicalRungeKuttaFieldIntegratorTest.java |  32 +++--
 .../DormandPrince54FieldIntegratorTest.java |  14 +-
 .../DormandPrince853FieldIntegratorTest.java|  14 +-
 .../ode/nonstiff/EulerFieldIntegratorTest.java  |  32 +++--
 .../ode/nonstiff/GillFieldIntegratorTest.java   |  32 +++--
 .../HighamHall54FieldIntegratorTest.java|  14 +-
 .../ode/nonstiff/LutherFieldIntegratorTest.java |  32 +++--
 .../nonstiff/MidpointFieldIntegratorTest.java   |  32 +++--
 .../ThreeEighthesFieldIntegratorTest.java   |  32 +++--
 11 files changed, 417 insertions(+), 99 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/a2efc6b6/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
index 26a7364..0f3449f 100644
--- 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
@@ -20,6 +20,7 @@ package org.apache.commons.math4.ode.nonstiff;
 
 import org.apache.commons.math4.Field;
 import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
 import org.apache.commons.math4.exception.DimensionMismatchException;
 import org.apache.commons.math4.exception.MaxCountExceededException;
 import org.apache.commons.math4.exception.NoBracketingException;
@@ -456,4 +457,144 @@ public abstract class 
AbstractEmbeddedRungeKuttaFieldIntegratorTest {
 }
 }
 
+@Test
+public abstract void testPartialDerivatives();
+
+protected > void 
doTestPartialDerivatives(final double epsilonY,
+
final double[] epsilonPartials) {
+
+// parameters indices
+final int parameters = 5;
+final int order  = 1;
+final int parOmega   = 0;
+final int parTO  = 1;
+final int parY00 = 2;
+final int parY01 = 3;
+final int parT   = 4;
+
+DerivativeStructure omega = new DerivativeStructure(parameters, order, 
parOmega, 1.3);
+DerivativeStructure t0= new DerivativeStructure(parameters, order, 
parTO, 1.3);
+DerivativeStructure[] y0  = new DerivativeStructure[] {
+new DerivativeStructure(parameters, order, parY00, 3.0),
+new DerivativeStructure(parameters, order, parY01, 4.0)
+};
+DerivativeStructure t = new DerivativeStructure(parameters, order, 
parT, 6.0);
+SinCos sinCos = new SinCos(omega);
+
+EmbeddedRungeKuttaFieldIntegrator integrator =
+createIntegrator(omega.getField(),
+ 
t.subtract(t0).multiply(0.001).getReal(), t.subtract(t0).getReal(),
+ 1.0e-12, 1.0e-12);
+FieldODEStateAndDerivative result =
+integrator.integrate(new 
FieldExpandableODE(sinCos),
+ new 
FieldODEState(t0, y0),
+ t);
+
+// check values
+for (int i = 0; i < sinCos.getDimension(); ++i) {
+Assert.assertEquals(sinCos.theoreticalY(t.getReal())[i], 
result.getState()[i].getValue(), epsilonY);
+}
+
+// check derivatives
+final double[][] derivatives = sinCos.getDerivatives(t.getReal()); 
+for (int i = 0; i < sinCos.getDimension(); ++i) {
+for (int parameter = 0; parameter < parameters; ++parameter) {
+Assert.assertEquals(derivatives[i][parameter], 
dYdP(result.getState()[i], parameter), epsilonPartials[parameter]);
+}
+}

[31/50] [abbrv] [math] Use immutable step interpolators.

2016-01-06 Thread luc
http://git-wip-us.apache.org/repos/asf/commons-math/blob/771eb6a6/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldIntegrator.java
 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldIntegrator.java
index 3a5f9aa..d052f4b 100644
--- 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldIntegrator.java
+++ 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldIntegrator.java
@@ -99,10 +99,15 @@ public abstract class RungeKuttaFieldIntegrator>
 
 /** Create an interpolator.
  * @param forward integration direction indicator
+ * @param yDotK slopes at the intermediate points
+ * @param globalPreviousState start of the global step
+ * @param globalCurrentState end of the global step
  * @param mapper equations mapper for the all equations
  * @return external weights for the high order method from Butcher array
  */
-protected abstract RungeKuttaFieldStepInterpolator 
createInterpolator(boolean forward,
+protected abstract RungeKuttaFieldStepInterpolator 
createInterpolator(boolean forward, T[][] yDotK,
+ 
final FieldODEStateAndDerivative globalPreviousState,
+ 
final FieldODEStateAndDerivative globalCurrentState,
  
FieldEquationsMapper mapper);
 
 /** {@inheritDoc} */
@@ -124,11 +129,6 @@ public abstract class RungeKuttaFieldIntegrator>
 final T[][] yDotK  = MathArrays.buildArray(getField(), stages, -1);
 final T[]   yTmp   = MathArrays.buildArray(getField(), y0.length);
 
-// set up an interpolator sharing the integrator arrays
-final RungeKuttaFieldStepInterpolator interpolator =
-createInterpolator(forward, equations.getMapper());
-interpolator.storeState(stepStart);
-
 // set up integration control objects
 if (forward) {
 if (stepStart.getTime().add(step).subtract(finalTime).getReal() >= 
0) {
@@ -148,8 +148,6 @@ public abstract class RungeKuttaFieldIntegrator>
 isLastStep = false;
 do {
 
-interpolator.shift();
-
 // first stage
 y= equations.getMapper().mapState(stepStart);
 yDotK[0] = equations.getMapper().mapDerivative(stepStart);
@@ -182,16 +180,12 @@ public abstract class RungeKuttaFieldIntegrator>
 final FieldODEStateAndDerivative stateTmp = new 
FieldODEStateAndDerivative(stepEnd, yTmp, yDotTmp);
 
 // discrete events handling
-interpolator.setSlopes(yDotK);
-interpolator.storeState(stateTmp);
 System.arraycopy(yTmp, 0, y, 0, y0.length);
-stepStart = acceptStep(interpolator, finalTime);
+stepStart = acceptStep(createInterpolator(forward, yDotK, 
stepStart, stateTmp, equations.getMapper()),
+   finalTime);
 
 if (!isLastStep) {
 
-// prepare next step
-interpolator.storeState(stepStart);
-
 // stepsize control for next step
 final T  nextT  = stepStart.getTime().add(stepSize);
 final boolean nextIsLast = forward ?

http://git-wip-us.apache.org/repos/asf/commons-math/blob/771eb6a6/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldStepInterpolator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldStepInterpolator.java
 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldStepInterpolator.java
index 26d8fb9..9595ee2 100644
--- 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldStepInterpolator.java
+++ 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldStepInterpolator.java
@@ -20,6 +20,7 @@ package org.apache.commons.math4.ode.nonstiff;
 import org.apache.commons.math4.Field;
 import org.apache.commons.math4.RealFieldElement;
 import org.apache.commons.math4.ode.FieldEquationsMapper;
+import org.apache.commons.math4.ode.FieldODEStateAndDerivative;
 import org.apache.commons.math4.ode.sampling.AbstractFieldStepInterpolator;
 import org.apache.commons.math4.util.MathArrays;
 
@@ -40,57 +41,63 @@ abstract class RungeKuttaFieldStepInterpolator>
 private final Field field;
 
 /** Slopes at the intermediate points. */
-private T[][] yDotK;
+private final T[][] yDotK;
 
 /** Simple constructor.
  * @param field field to which the time and state vector elements belong
  * @param forward integration direction indicator
+ * @param 

[44/50] [abbrv] [math] typo.

2016-01-06 Thread luc
typo.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/2a690ee8
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/2a690ee8
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/2a690ee8

Branch: refs/heads/master
Commit: 2a690ee895304076f6b0c984f52afed0cae37bf1
Parents: 305934d
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 14:18:56 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 14:18:56 2016 +0100

--
 src/site/xdoc/userguide/ode.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/2a690ee8/src/site/xdoc/userguide/ode.xml
--
diff --git a/src/site/xdoc/userguide/ode.xml b/src/site/xdoc/userguide/ode.xml
index ffbebc6..4d20b1f 100644
--- a/src/site/xdoc/userguide/ode.xml
+++ b/src/site/xdoc/userguide/ode.xml
@@ -315,7 +315,7 @@ public int eventOccurred(double t, double[] y, boolean 
increasing) {
   
href="../apidocs/org/apache/commons/math4/ode/JacobianMatrices.html">JacobianMatrices
 class can do most of
   this as long as the local derivatives are provided to it. It will 
set up the variational equations, register
   them as secondary equations into the ODE, and it will set up the 
initial values and retrieve the intermediate
-  and finale values as Jacobian matrices.
+  and final values as Jacobian matrices.
 
 
   If for example the original state dimension is 6 and there are 3 
parameters, the compound state will be a 60



[20/50] [abbrv] [math] Added tests for the Higham-Hall 5(4) integrator.

2016-01-06 Thread luc
Added tests for the Higham-Hall 5(4) integrator.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/7fc003df
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/7fc003df
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/7fc003df

Branch: refs/heads/master
Commit: 7fc003df8e22a4dcd2f16f5634fb9d8263ff5d04
Parents: d6a8ed5
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:32 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:32 2016 +0100

--
 .../HighamHall54FieldIntegratorTest.java| 93 
 .../HighamHall54FieldStepInterpolatorTest.java  | 49 +++
 2 files changed, 142 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/7fc003df/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldIntegratorTest.java
new file mode 100644
index 000..d24d286
--- /dev/null
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldIntegratorTest.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math4.ode.nonstiff;
+
+
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.util.Decimal64Field;
+import org.junit.Test;
+
+public class HighamHall54FieldIntegratorTest extends 
AbstractEmbeddedRungeKuttaFieldIntegratorTest {
+
+protected > 
EmbeddedRungeKuttaFieldIntegrator
+createIntegrator(Field field, final double minStep, final double 
maxStep,
+ final double scalAbsoluteTolerance, final double 
scalRelativeTolerance) {
+return new HighamHall54FieldIntegrator(field, minStep, maxStep, 
scalAbsoluteTolerance, scalRelativeTolerance);
+}
+
+protected > 
EmbeddedRungeKuttaFieldIntegrator
+createIntegrator(Field field, final double minStep, final double 
maxStep,
+ final double[] vecAbsoluteTolerance, final double[] 
vecRelativeTolerance) {
+return new HighamHall54FieldIntegrator(field, minStep, maxStep, 
vecAbsoluteTolerance, vecRelativeTolerance);
+}
+
+@Test
+public void testNonFieldIntegratorConsistency() {
+doTestNonFieldIntegratorConsistency(Decimal64Field.getInstance());
+}
+
+@Test
+public void testSanityChecks() {
+doTestSanityChecks(Decimal64Field.getInstance());
+}
+
+@Test
+public void testBackward() {
+doTestBackward(Decimal64Field.getInstance(), 5.0e-7, 5.0e-7, 1.0e-12, 
"Higham-Hall 5(4)");
+}
+
+@Test
+public void testKepler() {
+doTestKepler(Decimal64Field.getInstance(), 1.5e-4);
+}
+
+@Override
+public void testForwardBackwardExceptions() {
+doTestForwardBackwardExceptions(Decimal64Field.getInstance());
+}
+
+@Override
+public void testMinStep() {
+doTestMinStep(Decimal64Field.getInstance());
+}
+
+@Override
+public void testIncreasingTolerance() {
+// the 1.3 factor is only valid for this test
+// and has been obtained from trial and error
+// there is no general relation between local and global errors
+doTestIncreasingTolerance(Decimal64Field.getInstance(), 1.3, 1.0e-12);
+}
+
+@Override
+public void testEvents() {
+doTestEvents(Decimal64Field.getInstance(), 1.0e-7, "Higham-Hall 5(4)");
+}
+
+@Override
+public void testEventsErrors() {
+doTestEventsErrors(Decimal64Field.getInstance());
+}
+
+@Override
+public void testEventsNoConvergence() {
+doTestEventsNoConvergence(Decimal64Field.getInstance());
+}
+
+}

http://git-wip-us.apache.org/repos/asf/c

[43/50] [abbrv] [math] Field-based Adams-Bashforth integrator.

2016-01-06 Thread luc
Field-based Adams-Bashforth integrator.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/305934df
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/305934df
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/305934df

Branch: refs/heads/master
Commit: 305934dfbd2b37deb50cf93732e442c51bb1603b
Parents: dd9dc94
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 14:18:39 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 14:18:39 2016 +0100

--
 .../nonstiff/AdamsBashforthFieldIntegrator.java | 374 +++
 .../AdamsBashforthFieldIntegratorTest.java  |  78 
 2 files changed, 452 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/305934df/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegrator.java
 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegrator.java
new file mode 100644
index 000..db6bf4f
--- /dev/null
+++ 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegrator.java
@@ -0,0 +1,374 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math4.ode.nonstiff;
+
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.linear.Array2DRowFieldMatrix;
+import org.apache.commons.math4.linear.FieldMatrix;
+import org.apache.commons.math4.ode.FieldExpandableODE;
+import org.apache.commons.math4.ode.FieldODEState;
+import org.apache.commons.math4.ode.FieldODEStateAndDerivative;
+import org.apache.commons.math4.util.MathArrays;
+
+
+/**
+ * This class implements explicit Adams-Bashforth integrators for Ordinary
+ * Differential Equations.
+ *
+ * Adams-Bashforth methods (in fact due to Adams alone) are explicit
+ * multistep ODE solvers. This implementation is a variation of the classical
+ * one: it uses adaptive stepsize to implement error control, whereas
+ * classical implementations are fixed step size. The value of state vector
+ * at step n+1 is a simple combination of the value at step n and of the
+ * derivatives at steps n, n-1, n-2 ... Depending on the number k of previous
+ * steps one wants to use for computing the next value, different formulas
+ * are available:
+ * 
+ *   k = 1: yn+1 = yn + h y'n
+ *   k = 2: yn+1 = yn + h 
(3y'n-y'n-1)/2
+ *   k = 3: yn+1 = yn + h 
(23y'n-16y'n-1+5y'n-2)/12
+ *   k = 4: yn+1 = yn + h 
(55y'n-59y'n-1+37y'n-2-9y'n-3)/24
+ *   ...
+ * 
+ *
+ * A k-steps Adams-Bashforth method is of order k.
+ *
+ * Implementation details
+ *
+ * We define scaled derivatives si(n) at step n as:
+ * 
+ * s1(n) = h y'n for first derivative
+ * s2(n) = h2/2 y''n for second derivative
+ * s3(n) = h3/6 y'''n for third derivative
+ * ...
+ * sk(n) = hk/k! y(k)n for 
kth derivative
+ * 
+ *
+ * The definitions above use the classical representation with several 
previous first
+ * derivatives. Lets define
+ * 
+ *   qn = [ s1(n-1) s1(n-2) ... 
s1(n-(k-1)) ]T
+ * 
+ * (we omit the k index in the notation for clarity). With these definitions,
+ * Adams-Bashforth methods can be written:
+ * 
+ *   k = 1: yn+1 = yn + s1(n)
+ *   k = 2: yn+1 = yn + 3/2 s1(n) + [ 
-1/2 ] qn
+ *   k = 3: yn+1 = yn + 23/12 s1(n) + [ 
-16/12 5/12 ] qn
+ *   k = 4: yn+1 = yn + 55/24 s1(n) + [ 
-59/24 37/24 -9/24 ] qn
+ *   ...
+ * 
+ *
+ * Instead of using the classical representation with first derivatives 
only (yn,
+ * s1(n) and qn), our implementation uses the Nordsieck 
vector with
+ * h

[50/50] [abbrv] [math] Reintroduced @Override as master needs at least Java 7.

2016-01-06 Thread luc
Reintroduced @Override as master needs at least Java 7.

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/e76bf903
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/e76bf903
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/e76bf903

Branch: refs/heads/master
Commit: e76bf903a268c242011618730cba7a7bae8d380c
Parents: 9d47e0f
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 14:29:16 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 14:29:16 2016 +0100

--
 .../org/apache/commons/math4/ode/MultistepFieldIntegrator.java | 2 ++
 .../commons/math4/ode/nonstiff/AdamsMoultonFieldIntegrator.java| 2 ++
 2 files changed, 4 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/e76bf903/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java 
b/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java
index d1ad3c8..fdb1d90 100644
--- a/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java
@@ -388,6 +388,7 @@ public abstract class MultistepFieldIntegrator>
 }
 
 /** {@inheritDoc} */
+@Override
 public void handleStep(FieldStepInterpolator interpolator, boolean 
isLast)
 throws MaxCountExceededException {
 
@@ -431,6 +432,7 @@ public abstract class MultistepFieldIntegrator>
 }
 
 /** {@inheritDoc} */
+@Override
 public void init(final FieldODEStateAndDerivative initialState, T 
finalTime) {
 // nothing to do
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e76bf903/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonFieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonFieldIntegrator.java
 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonFieldIntegrator.java
index b09942d..c659cc0 100644
--- 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonFieldIntegrator.java
+++ 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonFieldIntegrator.java
@@ -370,12 +370,14 @@ public class AdamsMoultonFieldIntegrator> extends
 }
 
 /** {@inheritDoc} */
+@Override
 public void start(int rows, int columns,
   int startRow, int endRow, int startColumn, int 
endColumn) {
 Arrays.fill(after, getField().getZero());
 }
 
 /** {@inheritDoc} */
+@Override
 public void visit(int row, int column, T value) {
 if ((row & 0x1) == 0) {
 after[column] = after[column].subtract(value);



[15/50] [abbrv] [math] Fixed exception handling for too many iterations in event search.

2016-01-06 Thread luc
Fixed exception handling for too many iterations in event search.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/084ab518
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/084ab518
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/084ab518

Branch: refs/heads/master
Commit: 084ab518eecbac7b9b9a711d21021bd7df13dda8
Parents: 9e23079
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:24 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:24 2016 +0100

--
 .../math4/ode/events/FieldEventState.java   | 174 ---
 1 file changed, 70 insertions(+), 104 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/084ab518/src/main/java/org/apache/commons/math4/ode/events/FieldEventState.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/events/FieldEventState.java 
b/src/main/java/org/apache/commons/math4/ode/events/FieldEventState.java
index ffd0d7b..49b25bd 100644
--- a/src/main/java/org/apache/commons/math4/ode/events/FieldEventState.java
+++ b/src/main/java/org/apache/commons/math4/ode/events/FieldEventState.java
@@ -191,100 +191,91 @@ public class FieldEventState> {
 public boolean evaluateStep(final FieldStepInterpolator interpolator)
 throws MaxCountExceededException, NoBracketingException {
 
-try {
-forward = interpolator.isForward();
-final FieldODEStateAndDerivative s1 = 
interpolator.getCurrentState();
-final T t1 = s1.getTime();
-final T dt = t1.subtract(t0);
-if (dt.abs().subtract(convergence).getReal() < 0) {
-// we cannot do anything on such a small step, don't trigger 
any events
-return false;
+forward = interpolator.isForward();
+final FieldODEStateAndDerivative s1 = 
interpolator.getCurrentState();
+final T t1 = s1.getTime();
+final T dt = t1.subtract(t0);
+if (dt.abs().subtract(convergence).getReal() < 0) {
+// we cannot do anything on such a small step, don't trigger any 
events
+return false;
+}
+final int n = FastMath.max(1, (int) 
FastMath.ceil(FastMath.abs(dt.getReal()) / maxCheckInterval));
+final T   h = dt.divide(n);
+
+final RealFieldUnivariateFunction f = new 
RealFieldUnivariateFunction() {
+/** {@inheritDoc} */
+public T value(final T t) {
+return handler.g(interpolator.getInterpolatedState(t));
 }
-final int n = FastMath.max(1, (int) 
FastMath.ceil(FastMath.abs(dt.getReal()) / maxCheckInterval));
-final T   h = dt.divide(n);
-
-final RealFieldUnivariateFunction f = new 
RealFieldUnivariateFunction() {
-/** {@inheritDoc} */
-public T value(final T t) throws 
LocalMaxCountExceededException {
-try {
-return handler.g(interpolator.getInterpolatedState(t));
-} catch (MaxCountExceededException mcee) {
-throw new LocalMaxCountExceededException(mcee);
-}
-}
-};
-
-T ta = t0;
-T ga = g0;
-for (int i = 0; i < n; ++i) {
-
-// evaluate handler value at the end of the substep
-final T tb = (i == n - 1) ? t1 : t0.add(h.multiply(i + 1));
-final T gb = handler.g(interpolator.getInterpolatedState(tb));
-
-// check events occurrence
-if (g0Positive ^ (gb.getReal() >= 0)) {
-// there is a sign change: an event is expected during 
this step
-
-// variation direction, with respect to the integration 
direction
-increasing = gb.subtract(ga).getReal() >= 0;
-
-// find the event time making sure we select a solution 
just at or past the exact root
-final T root = forward ?
-   solver.solve(maxIterationCount, f, ta, tb, 
AllowedSolution.RIGHT_SIDE) :
-   solver.solve(maxIterationCount, f, tb, ta, 
AllowedSolution.LEFT_SIDE);
-
-if (previousEventTime != null &&
-
root.subtract(ta).abs().subtract(convergence).getReal() <= 0 &&
-
root.subtract(previousEventTime).abs().subtract(convergence).getReal() <= 0) {
-// we have either found nothing or found (again ?) a 
past event,
-// retry the su

[39/50] [abbrv] [math] Renamed interfaces for consistency with other classes.

2016-01-06 Thread luc
Renamed interfaces for consistency with other classes.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/346a81d7
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/346a81d7
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/346a81d7

Branch: refs/heads/master
Commit: 346a81d770fcd5e7e401a8d1daa42acf6493c2f8
Parents: 0aa826e
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 14:15:09 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 14:15:09 2016 +0100

--
 .../math4/ode/AbstractFieldIntegrator.java  |   2 +-
 .../commons/math4/ode/FieldExpandableODE.java   |   8 +-
 .../FieldFirstOrderDifferentialEquations.java   |  73 ---
 .../math4/ode/FieldFirstOrderIntegrator.java| 188 ---
 .../apache/commons/math4/ode/FieldODEState.java |   4 +-
 .../math4/ode/FieldODEStateAndDerivative.java   |   4 +-
 .../math4/ode/FieldSecondaryEquations.java  |   4 +-
 .../FirstOrderFieldDifferentialEquations.java   |  73 +++
 .../math4/ode/FirstOrderFieldIntegrator.java| 188 +++
 .../ode/nonstiff/RungeKuttaFieldIntegrator.java |   4 +-
 .../sampling/AbstractFieldStepInterpolator.java |   2 +-
 .../math4/ode/sampling/FieldStepHandler.java|   2 +-
 .../ode/sampling/FieldStepInterpolator.java |   2 +-
 src/site/xdoc/userguide/ode.xml |   4 +-
 .../ode/ContinuousOutputFieldModelTest.java |  14 +-
 .../math4/ode/FieldExpandableODETest.java   |  20 +-
 .../math4/ode/TestFieldProblemAbstract.java |   2 +-
 .../math4/ode/TestFieldProblemHandler.java  |   4 +-
 ...ctEmbeddedRungeKuttaFieldIntegratorTest.java |  20 +-
 .../AbstractRungeKuttaFieldIntegratorTest.java  |  10 +-
 ...ractRungeKuttaFieldStepInterpolatorTest.java |  10 +-
 .../math4/ode/nonstiff/StepFieldProblem.java|   4 +-
 .../ode/sampling/StepInterpolatorTestUtils.java |   4 +-
 23 files changed, 323 insertions(+), 323 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/346a81d7/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java 
b/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
index d741de5..41d7f15 100644
--- a/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
@@ -47,7 +47,7 @@ import org.apache.commons.math4.util.IntegerSequence;
  * @param  the type of the field elements
  * @since 3.6
  */
-public abstract class AbstractFieldIntegrator> 
implements FieldFirstOrderIntegrator {
+public abstract class AbstractFieldIntegrator> 
implements FirstOrderFieldIntegrator {
 
 /** Default relative accuracy. */
 private static final double DEFAULT_RELATIVE_ACCURACY = 1e-14;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/346a81d7/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java
--
diff --git a/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java 
b/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java
index 5e31a04..e5dd205 100644
--- a/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java
+++ b/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java
@@ -38,11 +38,11 @@ import org.apache.commons.math4.util.MathArrays;
  * 
  * We want the integrator to use only the primary set to estimate the
  * errors and hence the step sizes. It should not use the secondary
- * equations in this computation. The {@link FieldFirstOrderIntegrator 
integrator} will
+ * equations in this computation. The {@link FirstOrderFieldIntegrator 
integrator} will
  * be able to know where the primary set ends and so where the secondary sets 
begin.
  * 
  *
- * @see FieldFirstOrderDifferentialEquations
+ * @see FirstOrderFieldDifferentialEquations
  * @see FieldSecondaryEquations
  *
  * @param  the type of the field elements
@@ -52,7 +52,7 @@ import org.apache.commons.math4.util.MathArrays;
 public class FieldExpandableODE> {
 
 /** Primary differential equation. */
-private final FieldFirstOrderDifferentialEquations primary;
+private final FirstOrderFieldDifferentialEquations primary;
 
 /** Components of the expandable ODE. */
 private List<FieldSecondaryEquations> components;
@@ -63,7 +63,7 @@ public class FieldExpandableODE> {
 /** Build an expandable set from its primary ODE set.
  * @param primary the primary set of differential equations to be 
integrated.
  */
-p

[22/50] [abbrv] [math] Added tests for the Dormand-Prince 8(5, 3) integrator.

2016-01-06 Thread luc
Added tests for the Dormand-Prince 8(5,3) integrator.

BEWARE! These test do not pass yet. The integrator is currently not
consistent with the regular double-based integrator.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/f3cdf561
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/f3cdf561
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/f3cdf561

Branch: refs/heads/master
Commit: f3cdf561fd06b177a0b602b3ae6d6e845788c6bd
Parents: 2e4b80f
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:34 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:34 2016 +0100

--
 .../DormandPrince853FieldIntegratorTest.java| 93 
 ...rmandPrince853FieldStepInterpolatorTest.java | 49 +++
 2 files changed, 142 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/f3cdf561/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldIntegratorTest.java
new file mode 100644
index 000..47a59ba
--- /dev/null
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldIntegratorTest.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math4.ode.nonstiff;
+
+
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.util.Decimal64Field;
+import org.junit.Test;
+
+public class DormandPrince853FieldIntegratorTest extends 
AbstractEmbeddedRungeKuttaFieldIntegratorTest {
+
+protected > 
EmbeddedRungeKuttaFieldIntegrator
+createIntegrator(Field field, final double minStep, final double 
maxStep,
+ final double scalAbsoluteTolerance, final double 
scalRelativeTolerance) {
+return new DormandPrince853FieldIntegrator(field, minStep, maxStep, 
scalAbsoluteTolerance, scalRelativeTolerance);
+}
+
+protected > 
EmbeddedRungeKuttaFieldIntegrator
+createIntegrator(Field field, final double minStep, final double 
maxStep,
+ final double[] vecAbsoluteTolerance, final double[] 
vecRelativeTolerance) {
+return new DormandPrince853FieldIntegrator(field, minStep, maxStep, 
vecAbsoluteTolerance, vecRelativeTolerance);
+}
+
+@Test
+public void testNonFieldIntegratorConsistency() {
+doTestNonFieldIntegratorConsistency(Decimal64Field.getInstance());
+}
+
+@Test
+public void testSanityChecks() {
+doTestSanityChecks(Decimal64Field.getInstance());
+}
+
+@Test
+public void testBackward() {
+doTestBackward(Decimal64Field.getInstance(), 1.1e-7, 1.1e-7, 1.0e-12, 
"Dormand-Prince 8 (5, 3)");
+}
+
+@Test
+public void testKepler() {
+doTestKepler(Decimal64Field.getInstance(), 2.4e-10);
+}
+
+@Override
+public void testForwardBackwardExceptions() {
+doTestForwardBackwardExceptions(Decimal64Field.getInstance());
+}
+
+@Override
+public void testMinStep() {
+doTestMinStep(Decimal64Field.getInstance());
+}
+
+@Override
+public void testIncreasingTolerance() {
+// the 1.3 factor is only valid for this test
+// and has been obtained from trial and error
+// there is no general relation between local and global errors
+doTestIncreasingTolerance(Decimal64Field.getInstance(), 1.3, 1.0e-12);
+}
+
+@Override
+public void testEvents() {
+doTestEvents(Decimal64Field.getInstance(), 2.1e-7, "Dormand-Prince 8 
(5, 3)");
+}
+
+@Override
+public void testEventsErrors() {
+doTestEventsErrors(Decimal64Field.getInstance());
+}

[38/50] [abbrv] [math] Reintroduced @Override as master needs at least Java 7.

2016-01-06 Thread luc
Reintroduced @Override as master needs at least Java 7.

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/0aa826e8
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/0aa826e8
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/0aa826e8

Branch: refs/heads/master
Commit: 0aa826e84b14f6f39b23a057986c1329657b9c46
Parents: 6e4265d
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 13:40:45 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 13:40:45 2016 +0100

--
 .../commons/math4/ode/AbstractFieldIntegrator.java| 14 ++
 .../commons/math4/ode/ContinuousOutputFieldModel.java |  1 +
 .../commons/math4/ode/events/FieldEventState.java |  1 +
 .../ClassicalRungeKuttaFieldStepInterpolator.java |  1 +
 .../DormandPrince54FieldStepInterpolator.java |  1 +
 .../DormandPrince853FieldStepInterpolator.java|  1 +
 .../ode/nonstiff/EulerFieldStepInterpolator.java  |  1 +
 .../math4/ode/nonstiff/GillFieldStepInterpolator.java |  1 +
 .../nonstiff/HighamHall54FieldStepInterpolator.java   |  1 +
 .../ode/nonstiff/LutherFieldStepInterpolator.java |  1 +
 .../ode/nonstiff/MidpointFieldStepInterpolator.java   |  1 +
 .../ode/nonstiff/RungeKuttaFieldStepInterpolator.java |  1 +
 .../nonstiff/ThreeEighthesFieldStepInterpolator.java  |  1 +
 .../ode/sampling/AbstractFieldStepInterpolator.java   |  4 
 .../math4/ode/sampling/FieldStepNormalizer.java   |  1 +
 15 files changed, 31 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/0aa826e8/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java 
b/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
index 81f4085..d741de5 100644
--- a/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
@@ -108,26 +108,31 @@ public abstract class AbstractFieldIntegrator> imp
 }
 
 /** {@inheritDoc} */
+@Override
 public String getName() {
 return name;
 }
 
 /** {@inheritDoc} */
+@Override
 public void addStepHandler(final FieldStepHandler handler) {
 stepHandlers.add(handler);
 }
 
 /** {@inheritDoc} */
+@Override
 public Collection<FieldStepHandler> getStepHandlers() {
 return Collections.unmodifiableCollection(stepHandlers);
 }
 
 /** {@inheritDoc} */
+@Override
 public void clearStepHandlers() {
 stepHandlers.clear();
 }
 
 /** {@inheritDoc} */
+@Override
 public void addEventHandler(final FieldEventHandler handler,
 final double maxCheckInterval,
 final double convergence,
@@ -141,6 +146,7 @@ public abstract class AbstractFieldIntegrator> imp
 }
 
 /** {@inheritDoc} */
+@Override
 public void addEventHandler(final FieldEventHandler handler,
 final double maxCheckInterval,
 final double convergence,
@@ -151,6 +157,7 @@ public abstract class AbstractFieldIntegrator> imp
 }
 
 /** {@inheritDoc} */
+@Override
 public Collection<FieldEventHandler> getEventHandlers() {
 final List<FieldEventHandler> list = new 
ArrayList<FieldEventHandler>(eventsStates.size());
 for (FieldEventState state : eventsStates) {
@@ -160,31 +167,37 @@ public abstract class AbstractFieldIntegrator> imp
 }
 
 /** {@inheritDoc} */
+@Override
 public void clearEventHandlers() {
 eventsStates.clear();
 }
 
 /** {@inheritDoc} */
+@Override
 public FieldODEStateAndDerivative getCurrentStepStart() {
 return stepStart;
 }
 
 /** {@inheritDoc} */
+@Override
 public T getCurrentSignedStepsize() {
 return stepSize;
 }
 
 /** {@inheritDoc} */
+@Override
 public void setMaxEvaluations(int maxEvaluations) {
 evaluations = evaluations.withMaximalCount((maxEvaluations < 0) ? 
Integer.MAX_VALUE : maxEvaluations);
 }
 
 /** {@inheritDoc} */
+@Override
 public int getMaxEvaluations() {
 return evaluations.getMaximalCount();
 }
 
 /** {@inheritDoc} */
+@Override
 public int getEvaluations() {
 return evaluations.getCount();
 }
@@ -294,6 +307,7 @@ public abstract class AbstractFieldIntegrator> imp
 SortedSet<FieldEventState> occurringEvents = new 
TreeSet<FieldEventState>(new Comparator<FieldEventState>

[13/50] [abbrv] [math] Added new consistency tests.

2016-01-06 Thread luc
Added new consistency tests.

We want the field-based integrators to be consistent with the regular
double-based integrators.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/235a0914
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/235a0914
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/235a0914

Branch: refs/heads/master
Commit: 235a0914e97fb3da2750a745c77fc01166bbb59f
Parents: c23335b
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:22 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:22 2016 +0100

--
 ...ractRungeKuttaFieldStepInterpolatorTest.java | 124 ++-
 ...sicalRungKuttaFieldStepInterpolatorTest.java |   5 +
 .../EulerFieldStepInterpolatorTest.java |   5 +
 .../nonstiff/GillFieldStepInterpolatorTest.java |   5 +
 .../LutherFieldStepInterpolatorTest.java|   5 +
 .../MidpointFieldStepInterpolatorTest.java  |   5 +
 .../ThreeEighthesFieldStepInterpolatorTest.java |   5 +
 7 files changed, 152 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/235a0914/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
index 0ca38aa..a692717 100644
--- 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
@@ -22,10 +22,12 @@ import java.lang.reflect.InvocationTargetException;
 
 import org.apache.commons.math4.Field;
 import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.ode.EquationsMapper;
 import org.apache.commons.math4.ode.FieldEquationsMapper;
 import org.apache.commons.math4.ode.FieldExpandableODE;
 import org.apache.commons.math4.ode.FieldFirstOrderDifferentialEquations;
 import org.apache.commons.math4.ode.FieldODEStateAndDerivative;
+import org.apache.commons.math4.ode.sampling.AbstractFieldStepInterpolator;
 import org.apache.commons.math4.util.FastMath;
 import org.apache.commons.math4.util.MathArrays;
 import org.junit.Assert;
@@ -86,6 +88,49 @@ public abstract class 
AbstractRungeKuttaFieldStepInterpolatorTest {
 
 }
 
+@Test
+public abstract void nonFieldInterpolatorConsistency();
+
+protected > void 
doNonFieldInterpolatorConsistency(final Field field,
+   
  double epsilonSin, double epsilonCos,
+   
  double epsilonSinDot, double epsilonCosDot) {
+
+RungeKuttaFieldStepInterpolator fieldInterpolator =
+setUpInterpolator(field, new SinCos<>(field), 0.0, new 
double[] { 0.0, 1.0 }, 0.125);
+RungeKuttaStepInterpolator regularInterpolator = 
convertInterpolator(fieldInterpolator);
+
+int n = 100;
+double maxErrorSin= 0;
+double maxErrorCos= 0;
+double maxErrorSinDot = 0;
+double maxErrorCosDot = 0;
+for (int i = 0; i <= n; ++i) {
+
+T t = 
fieldInterpolator.getPreviousState().getTime().multiply(n - i).
+  
add(fieldInterpolator.getCurrentState().getTime().multiply(i)).
+  divide(n);
+
+FieldODEStateAndDerivative state = 
fieldInterpolator.getInterpolatedState(t);
+T[] fieldY= state.getState();
+T[] fieldYDot = state.getDerivative();
+
+regularInterpolator.setInterpolatedTime(t.getReal());
+double[] regularY = regularInterpolator.getInterpolatedState();
+double[] regularYDot  = 
regularInterpolator.getInterpolatedDerivatives();
+
+maxErrorSin= FastMath.max(maxErrorSin,
fieldY[0].subtract(regularY[0]).abs().getReal());
+maxErrorCos= FastMath.max(maxErrorCos,
fieldY[1].subtract(regularY[1]).abs().getReal());
+maxErrorSinDot = FastMath.max(maxErrorSinDot, 
fieldYDot[0].subtract(regularYDot[0]).abs().getReal());
+maxErrorCosDot = FastMath.max(maxErrorCosDot, 
fieldYDot[1].subtract(regularYDot[1]).abs().getReal());
+
+}
+Assert.assertEquals(0.0, maxErrorSin,epsilonSin);
+Assert.assertEquals(0.0, maxErrorCos,epsilonCos);
+Assert.assertEquals(0.0, maxErrorSinDot, epsilonSinDot);
+Assert.assertEq

[17/50] [abbrv] [math] Set up test framework for field-based embedded Runge-Kutta integrators.

2016-01-06 Thread luc
Set up test framework for field-based embedded Runge-Kutta integrators.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/87edfd27
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/87edfd27
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/87edfd27

Branch: refs/heads/master
Commit: 87edfd2751ba8bf84f15aa1df288722c36ffcbf0
Parents: 7a5431e
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:26 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:26 2016 +0100

--
 ...ctEmbeddedRungeKuttaFieldIntegratorTest.java | 445 +++
 1 file changed, 445 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/87edfd27/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
new file mode 100644
index 000..357d92a
--- /dev/null
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
@@ -0,0 +1,445 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math4.ode.nonstiff;
+
+
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.ode.FieldExpandableODE;
+import org.apache.commons.math4.ode.FieldFirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.FieldFirstOrderIntegrator;
+import org.apache.commons.math4.ode.FieldODEState;
+import org.apache.commons.math4.ode.FieldODEStateAndDerivative;
+import org.apache.commons.math4.ode.TestFieldProblem1;
+import org.apache.commons.math4.ode.TestFieldProblem3;
+import org.apache.commons.math4.ode.TestFieldProblem4;
+import org.apache.commons.math4.ode.TestFieldProblem5;
+import org.apache.commons.math4.ode.TestFieldProblemHandler;
+import org.apache.commons.math4.ode.events.Action;
+import org.apache.commons.math4.ode.events.FieldEventHandler;
+import org.apache.commons.math4.ode.sampling.FieldStepHandler;
+import org.apache.commons.math4.ode.sampling.FieldStepInterpolator;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+import org.junit.Assert;
+import org.junit.Test;
+
+public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest {
+
+protected abstract > 
EmbeddedRungeKuttaFieldIntegrator
+createIntegrator(Field field, final double minStep, final double 
maxStep,
+ final double scalAbsoluteTolerance, final double 
scalRelativeTolerance) ;
+
+protected abstract > 
EmbeddedRungeKuttaFieldIntegrator
+createIntegrator(Field field, final double minStep, final double 
maxStep,
+ final double[] vecAbsoluteTolerance, final double[] 
vecRelativeTolerance);
+
+@Test
+public abstract void testNonFieldIntegratorConsistency();
+
+protected > void 
doTestNonFieldIntegratorConsistency(final Field field) {
+try {
+
+// get the Butcher arrays from the field integrator
+EmbeddedRungeKuttaFieldIntegrator fieldIntegrator = 
createIntegrator(field, 0.001, 1.0, 1.0, 1.0);
+T[][] fieldA = fieldIntegrator.getA();
+T[]   fieldB = fieldIntegrator.getB();
+T[]   fieldC = fieldIntegrator.getC();
+
+String fieldName   = fieldIntegrator.getClass().getName();
+String regularName = fieldName.replaceAll("

[28/50] [abbrv] [math] Removed unneeded field.

2016-01-06 Thread luc
Removed unneeded field.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/11df45b7
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/11df45b7
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/11df45b7

Branch: refs/heads/master
Commit: 11df45b7bdf0e836df475cd480f5287f4256f493
Parents: 2773215
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:41 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:41 2016 +0100

--
 .../org/apache/commons/math4/ode/AbstractFieldIntegrator.java| 4 
 1 file changed, 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/11df45b7/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java 
b/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
index 878f435..07fa9a0 100644
--- a/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
@@ -67,9 +67,6 @@ public abstract class AbstractFieldIntegrator> imp
 /** Indicator for last step. */
 protected boolean isLastStep;
 
-/** Indicator that a state or derivative reset was triggered by some 
event. */
-protected boolean resetOccurred;
-
 /** Field to which the time and state vector elements belong. */
 private final Field field;
 
@@ -348,7 +345,6 @@ public abstract class AbstractFieldIntegrator> imp
 // invalidate the derivatives, we need to recompute 
them
 final T[] y= 
equations.getMapper().mapState(newState);
 final T[] yDot = 
computeDerivatives(newState.getTime(), y);
-resetOccurred = true;
 return 
equations.getMapper().mapStateAndDerivative(newState.getTime(), y, yDot);
 }
 }



[19/50] [abbrv] [math] Prevent NullPointerException in tests.

2016-01-06 Thread luc
Prevent NullPointerException in tests.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/d6a8ed57
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/d6a8ed57
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/d6a8ed57

Branch: refs/heads/master
Commit: d6a8ed57b8e1fdeaa3b6bb4360b6de0d66dc6450
Parents: a2718fc
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:31 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:31 2016 +0100

--
 ...ractRungeKuttaFieldStepInterpolatorTest.java | 32 +---
 1 file changed, 27 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/d6a8ed57/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
index 6dfdeab..64e91a2 100644
--- 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
@@ -22,7 +22,9 @@ import java.lang.reflect.InvocationTargetException;
 
 import org.apache.commons.math4.Field;
 import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.ode.AbstractIntegrator;
 import org.apache.commons.math4.ode.EquationsMapper;
+import org.apache.commons.math4.ode.ExpandableStatefulODE;
 import org.apache.commons.math4.ode.FieldEquationsMapper;
 import org.apache.commons.math4.ode.FieldExpandableODE;
 import org.apache.commons.math4.ode.FieldFirstOrderDifferentialEquations;
@@ -70,7 +72,7 @@ public abstract class 
AbstractRungeKuttaFieldStepInterpolatorTest {
 
 RungeKuttaFieldStepInterpolator interpolator = 
setUpInterpolator(field,
 
new SinCos<>(field),
-
0.0, new double[] { 0.0, 1.0 }, 0.125);
+
0.0, new double[] { 0.0, 1.0 }, 0.0125);
 
 int n = 100;
 double maxErrorSin = 0;
@@ -95,9 +97,10 @@ public abstract class 
AbstractRungeKuttaFieldStepInterpolatorTest {

  double epsilonSin, double epsilonCos,

  double epsilonSinDot, double epsilonCosDot) {
 
+FieldFirstOrderDifferentialEquations eqn = new SinCos<>(field);
 RungeKuttaFieldStepInterpolator fieldInterpolator =
-setUpInterpolator(field, new SinCos<>(field), 0.0, new 
double[] { 0.0, 1.0 }, 0.125);
-RungeKuttaStepInterpolator regularInterpolator = 
convertInterpolator(fieldInterpolator);
+setUpInterpolator(field, eqn, 0.0, new double[] { 0.0, 
1.0 }, 0.125);
+RungeKuttaStepInterpolator regularInterpolator = 
convertInterpolator(fieldInterpolator, eqn);
 
 int n = 100;
 double maxErrorSin= 0;
@@ -185,7 +188,8 @@ public abstract class 
AbstractRungeKuttaFieldStepInterpolatorTest {
 }
 
 private >
-RungeKuttaStepInterpolator convertInterpolator(final 
RungeKuttaFieldStepInterpolator fieldInterpolator) {
+RungeKuttaStepInterpolator convertInterpolator(final 
RungeKuttaFieldStepInterpolator fieldInterpolator,
+   final 
FieldFirstOrderDifferentialEquations eqn) {
 
 RungeKuttaStepInterpolator regularInterpolator = null;
 try {
@@ -225,7 +229,25 @@ public abstract class 
AbstractRungeKuttaFieldStepInterpolatorTest {
 secondaryMappers[i] = new EquationsMapper(start[i + 1], 
start[i + 2]);
 }
 
-regularInterpolator.reinitialize(null, y, yDotArray,
+AbstractIntegrator dummyIntegrator = new 
AbstractIntegrator("dummy") {
+@Override
+public void integrate(ExpandableStatefulODE equations, double 
t) {
+Assert.fail("this method should not be called");
+}
+@Override
+public void computeDerivatives(final double t, final double[] 
y, final double[] yDot) {
+T fieldT = fieldInterpolator.getField().getZero().add(t);
+T[] fieldY = 
MathArr

[26/50] [abbrv] [math] Fixed field-based Dormand-Prince 8(5, 3) step interpolator.

2016-01-06 Thread luc
Fixed field-based Dormand-Prince 8(5,3) step interpolator.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/7a1c10a1
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/7a1c10a1
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/7a1c10a1

Branch: refs/heads/master
Commit: 7a1c10a162fd6e0043f523af98d57549573c1982
Parents: 73b7659
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:39 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:39 2016 +0100

--
 .../DormandPrince853FieldStepInterpolator.java  | 63 
 ...ctEmbeddedRungeKuttaFieldIntegratorTest.java | 14 +
 .../DormandPrince853FieldIntegratorTest.java|  4 +-
 ...rmandPrince853FieldStepInterpolatorTest.java |  4 +-
 4 files changed, 70 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/7a1c10a1/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldStepInterpolator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldStepInterpolator.java
 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldStepInterpolator.java
index 6487ccf..68573fd 100644
--- 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldStepInterpolator.java
+++ 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldStepInterpolator.java
@@ -55,7 +55,7 @@ class DormandPrince853FieldStepInterpolator>
 d = MathArrays.buildArray(getField(), 7, 16);
 
 // this row is the same as the b array
-d[0][ 0] = fraction(104257, 1929240);
+d[0][ 0] = fraction(104257, 1920240);
 d[0][ 1] = getField().getZero();
 d[0][ 2] = getField().getZero();
 d[0][ 3] = getField().getZero();
@@ -101,10 +101,10 @@ class DormandPrince853FieldStepInterpolator>
 d[2][ 9] = d[0][ 9].multiply(2);
 d[2][10] = d[0][10].multiply(2);
 d[2][11] = d[0][11].multiply(2);
-d[2][12] = d[0][12].multiply(2); // really 0
-d[2][13] = d[0][13].multiply(2); // really 0
-d[2][14] = d[0][14].multiply(2); // really 0
-d[2][15] = d[0][15].multiply(2); // really 0
+d[2][12] = d[0][12].multiply(2).subtract(1); // really -1
+d[2][13] = d[0][13].multiply(2); // really  0
+d[2][14] = d[0][14].multiply(2); // really  0
+d[2][15] = d[0][15].multiply(2); // really  0
 
 d[3][ 0] = fraction(-17751989329.0, 2106076560.0);
 d[3][ 1] = getField().getZero();
@@ -215,7 +215,7 @@ class DormandPrince853FieldStepInterpolator>

final T oneMinusThetaH)
 throws MaxCountExceededException {
 
-final T one  = theta.getField().getOne();
+final T one  = getField().getOne();
 final T eta  = one.subtract(theta);
 final T twoTheta = theta.multiply(2);
 final T theta2   = theta.multiply(theta);
@@ -228,6 +228,7 @@ class DormandPrince853FieldStepInterpolator>
 final T[] interpolatedState;
 final T[] interpolatedDerivatives;
 
+
 if (getGlobalPreviousState() != null && theta.getReal() <= 0.5) {
 final T f0 = theta.multiply(h);
 final T f1 = f0.multiply(eta);
@@ -236,18 +237,58 @@ class DormandPrince853FieldStepInterpolator>
 final T f4 = f3.multiply(theta);
 final T f5 = f4.multiply(eta);
 final T f6 = f5.multiply(theta);
-interpolatedState   = previousStateLinearCombination(f0, f1, 
f2, f3, f4, f5, f6);
-interpolatedDerivatives = derivativeLinearCombination(one, dot1, 
dot2, dot3, dot4, dot5, dot6);
+final T[] p = MathArrays.buildArray(getField(), 16);
+final T[] q = MathArrays.buildArray(getField(), 16);
+for (int i = 0; i < p.length; ++i) {
+p[i] = f0.multiply(d[0][i]).
+   add(f1.multiply(d[1][i])).
+   add(f2.multiply(d[2][i])).
+   add(f3.multiply(d[3][i])).
+   add(f4.multiply(d[4][i])).
+   add(f5.multiply(d[5][i])).
+   add(f6.multiply(d[6][i]));
+q[i] =d[0][i].
+add(dot1.multiply(d[1][i])).
+add(dot2.multiply(d[2][i])).
+add(dot3.multiply(d[3][i])).
+add(dot4.multiply(d[4][i])).
+add(dot5.multiply(d[5

[48/50] [abbrv] [math] Renamed abstract test classes to match build environment filters.

2016-01-06 Thread luc
http://git-wip-us.apache.org/repos/asf/commons-math/blob/9d47e0f9/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldIntegratorTest.java
index 3679f80..0630fcc 100644
--- 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldIntegratorTest.java
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldIntegratorTest.java
@@ -22,7 +22,7 @@ import org.apache.commons.math4.Field;
 import org.apache.commons.math4.RealFieldElement;
 import org.apache.commons.math4.util.Decimal64Field;
 
-public class HighamHall54FieldIntegratorTest extends 
AbstractEmbeddedRungeKuttaFieldIntegratorTest {
+public class HighamHall54FieldIntegratorTest extends 
EmbeddedRungeKuttaFieldIntegratorAbstractTest {
 
 protected > 
EmbeddedRungeKuttaFieldIntegrator
 createIntegrator(Field field, final double minStep, final double 
maxStep,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/9d47e0f9/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldStepInterpolatorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldStepInterpolatorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldStepInterpolatorTest.java
index 4bbe6f0..12c9473 100644
--- 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldStepInterpolatorTest.java
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldStepInterpolatorTest.java
@@ -25,7 +25,7 @@ import 
org.apache.commons.math4.ode.FieldODEStateAndDerivative;
 import org.apache.commons.math4.util.Decimal64Field;
 import org.junit.Test;
 
-public class HighamHall54FieldStepInterpolatorTest extends 
AbstractRungeKuttaFieldStepInterpolatorTest {
+public class HighamHall54FieldStepInterpolatorTest extends 
RungeKuttaFieldStepInterpolatorAbstractTest {
 
 protected > 
RungeKuttaFieldStepInterpolator
 createInterpolator(Field field, boolean forward, T[][] yDotK,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/9d47e0f9/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegratorTest.java
index 23fce20..9f459cf 100644
--- 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegratorTest.java
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegratorTest.java
@@ -26,7 +26,7 @@ import 
org.apache.commons.math4.exception.NoBracketingException;
 import org.apache.commons.math4.exception.NumberIsTooSmallException;
 import org.apache.commons.math4.util.Decimal64Field;
 
-public class LutherFieldIntegratorTest extends 
AbstractRungeKuttaFieldIntegratorTest {
+public class LutherFieldIntegratorTest extends 
RungeKuttaFieldIntegratorAbstractTest {
 
 protected > RungeKuttaFieldIntegrator
 createIntegrator(Field field, T step) {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/9d47e0f9/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolatorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolatorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolatorTest.java
index 39ebdb9..e35e1ec 100644
--- 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolatorTest.java
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolatorTest.java
@@ -25,7 +25,7 @@ import 
org.apache.commons.math4.ode.FieldODEStateAndDerivative;
 import org.apache.commons.math4.util.Decimal64Field;
 import org.junit.Test;
 
-public class LutherFieldStepInterpolatorTest extends 
AbstractRungeKuttaFieldStepInterpolatorTest {
+public class LutherFieldStepInterpolatorTest extends 
RungeKuttaFieldStepInterpolatorAbstractTest {
 
 protected > 
RungeKuttaFieldStepInterpolator
 createInterpolator(Field field, boolean forward, T[][] yDotK,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/9d47e0f9/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldIntegratorTest.java
index f6aadae..d983146 100644
--- 

[45/50] [abbrv] [math] Field-based implementation of Adams-Moulton ODE integrator.

2016-01-06 Thread luc
Field-based implementation of Adams-Moulton ODE integrator.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/82cf2774
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/82cf2774
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/82cf2774

Branch: refs/heads/master
Commit: 82cf2774a215ae46477e4b35decf77321e20ab34
Parents: 2a690ee
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 14:19:07 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 14:19:07 2016 +0100

--
 .../math4/ode/MultistepFieldIntegrator.java |  27 ++
 .../nonstiff/AdamsBashforthFieldIntegrator.java |  58 +--
 .../nonstiff/AdamsFieldStepInterpolator.java|  63 ++-
 .../nonstiff/AdamsMoultonFieldIntegrator.java   | 416 +++
 .../AbstractAdamsFieldIntegratorTest.java   |   9 +-
 .../AdamsBashforthFieldIntegratorTest.java  |   6 +-
 .../nonstiff/AdamsBashforthIntegratorTest.java  |   6 +-
 .../AdamsMoultonFieldIntegratorTest.java|  78 
 8 files changed, 579 insertions(+), 84 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/82cf2774/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java 
b/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java
index feec974..d1ad3c8 100644
--- a/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java
@@ -316,6 +316,33 @@ public abstract class MultistepFieldIntegrator>
   return nSteps;
 }
 
+/** Rescale the instance.
+ * Since the scaled and Nordsieck arrays are shared with the caller,
+ * this method has the side effect of rescaling this arrays in the caller 
too.
+ * @param newStepSize new step size to use in the scaled and Nordsieck 
arrays
+ */
+protected void rescale(final T newStepSize) {
+
+final T ratio = newStepSize.divide(getStepSize());
+for (int i = 0; i < scaled.length; ++i) {
+scaled[i] = scaled[i].multiply(ratio);
+}
+
+final T[][] nData = nordsieck.getDataRef();
+T power = ratio;
+for (int i = 0; i < nData.length; ++i) {
+power = power.multiply(ratio);
+final T[] nDataI = nData[i];
+for (int j = 0; j < nDataI.length; ++j) {
+nDataI[j] = nDataI[j].multiply(power);
+}
+}
+
+setStepSize(newStepSize);
+
+}
+
+
 /** Compute step grow/shrink factor according to normalized error.
  * @param error normalized error of the current step
  * @return grow/shrink factor for next step

http://git-wip-us.apache.org/repos/asf/commons-math/blob/82cf2774/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegrator.java
 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegrator.java
index db6bf4f..977573e 100644
--- 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegrator.java
+++ 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegrator.java
@@ -255,9 +255,11 @@ public class AdamsBashforthFieldIntegrator> extend
 start(equations, getStepStart(), finalTime);
 
 // reuse the step that was chosen by the starter integrator
-AdamsFieldStepInterpolator interpolator =
-new AdamsFieldStepInterpolator(getStepSize(), 
getStepStart(), scaled, nordsieck,
-  forward, 
equations.getMapper());
+FieldODEStateAndDerivative stepStart = getStepStart();
+FieldODEStateAndDerivative stepEnd   =
+AdamsFieldStepInterpolator.taylor(stepStart,
+  
stepStart.getTime().add(getStepSize()),
+  getStepSize(), 
scaled, nordsieck);
 
 // main integration loop
 setIsLastStep(false);
@@ -270,7 +272,6 @@ public class AdamsBashforthFieldIntegrator> extend
 while (error.subtract(1.0).getReal() >= 0.0) {
 
 // predict a first estimate of the state at step end
-final FieldODEStateAndDerivative stepEnd = 
interpolator.getCurrentState();
 predictedY = stepEnd.getState();
 
 // evaluate the derivative
@

[34/50] [abbrv] [math] Fixed additional equations mapping.

2016-01-06 Thread luc
Fixed additional equations mapping.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/49747dc1
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/49747dc1
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/49747dc1

Branch: refs/heads/master
Commit: 49747dc1d34a48e966ceb424f40f0b7994d1cea7
Parents: 5672ebe
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 13:29:52 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 13:29:52 2016 +0100

--
 .../commons/math4/ode/FieldEquationsMapper.java |  33 +-
 .../commons/math4/ode/FieldExpandableODE.java   |  12 +-
 .../apache/commons/math4/ode/FieldODEState.java |  16 +-
 .../math4/ode/FieldODEStateAndDerivative.java   |   3 +-
 .../ode/nonstiff/FieldExpandableODETest.java| 344 +++
 5 files changed, 361 insertions(+), 47 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/49747dc1/src/main/java/org/apache/commons/math4/ode/FieldEquationsMapper.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/FieldEquationsMapper.java 
b/src/main/java/org/apache/commons/math4/ode/FieldEquationsMapper.java
index 7a6c0d5..1febe7d 100644
--- a/src/main/java/org/apache/commons/math4/ode/FieldEquationsMapper.java
+++ b/src/main/java/org/apache/commons/math4/ode/FieldEquationsMapper.java
@@ -57,7 +57,7 @@ public class FieldEquationsMapper> implements Seri
 if (mapper == null) {
 start[0] = 0;
 } else {
-System.arraycopy(mapper.start, 0, start, 0, index);
+System.arraycopy(mapper.start, 0, start, 0, index + 1);
 }
 start[index + 1] = start[index] + dimension;
 }
@@ -88,7 +88,7 @@ public class FieldEquationsMapper> implements Seri
 int index = 0;
 insertEquationData(index, state.getState(), y);
 while (++index < getNumberOfEquations()) {
-insertEquationData(index, state.getSecondaryState(index - 1), y);
+insertEquationData(index, state.getSecondaryState(index), y);
 }
 return y;
 }
@@ -102,38 +102,11 @@ public class FieldEquationsMapper> implements Seri
 int index = 0;
 insertEquationData(index, state.getDerivative(), yDot);
 while (++index < getNumberOfEquations()) {
-insertEquationData(index, state.getSecondaryDerivative(index - 1), 
yDot);
+insertEquationData(index, state.getSecondaryDerivative(index), 
yDot);
 }
 return yDot;
 }
 
-/** Map a flat array to a state.
- * @param t time
- * @param y array to map, including primary and secondary components
- * @return mapped state
- * @exception DimensionMismatchException if array does not match total 
dimension
- */
-public FieldODEState mapState(final T t, final T[] y)
-throws DimensionMismatchException {
-
-if (y.length != getTotalDimension()) {
-throw new DimensionMismatchException(y.length, 
getTotalDimension());
-}
-
-final int n = getNumberOfEquations();
-int index = 0;
-final T[] state = extractEquationData(index, y);
-if (n < 2) {
-return new FieldODEState(t, state);
-} else {
-final T[][] secondaryState = MathArrays.buildArray(t.getField(), n 
- 1, -1);
-while (++index < n) {
-secondaryState[index - 1] = extractEquationData(index, y);
-}
-return new FieldODEState(t, state, secondaryState);
-}
-}
-
 /** Map flat arrays to a state and derivative.
  * @param t time
  * @param y state array to map, including primary and secondary components

http://git-wip-us.apache.org/repos/asf/commons-math/blob/49747dc1/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java
--
diff --git a/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java 
b/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java
index 2a8d6c0..5e31a04 100644
--- a/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java
+++ b/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java
@@ -69,13 +69,6 @@ public class FieldExpandableODE> {
 this.mapper = new FieldEquationsMapper(null, 
primary.getDimension());
 }
 
-/** Get the primary set of differential equations.
- * @return primary set of differential equations
- */
-public FieldFirstOrderDifferentialEquations getPrimary() {
-return primary;
-}
-
 /** Get the mapper for the set of equations.
  * @return mapper for the

[30/50] [abbrv] [math] Prevent NullPointerException.

2016-01-06 Thread luc
Prevent NullPointerException.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/0ddec291
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/0ddec291
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/0ddec291

Branch: refs/heads/master
Commit: 0ddec2917a8543e1f58e85e317ab4d07bd94f786
Parents: c246b37
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 13:22:26 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 13:22:26 2016 +0100

--
 src/main/java/org/apache/commons/math4/ode/FieldODEState.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/0ddec291/src/main/java/org/apache/commons/math4/ode/FieldODEState.java
--
diff --git a/src/main/java/org/apache/commons/math4/ode/FieldODEState.java 
b/src/main/java/org/apache/commons/math4/ode/FieldODEState.java
index 1c7bbe6..de01d97 100644
--- a/src/main/java/org/apache/commons/math4/ode/FieldODEState.java
+++ b/src/main/java/org/apache/commons/math4/ode/FieldODEState.java
@@ -113,7 +113,7 @@ public class FieldODEState> {
  * @return number of secondary states.
  */
 public int getNumberOfSecondaryStates() {
-return secondaryState.length;
+return secondaryState == null ? 0 : secondaryState.length;
 }
 
 /** Get secondary state dimension.



[23/50] [abbrv] [math] Fixed Dormand-Prince 5(4) field integrator constants.

2016-01-06 Thread luc
Fixed Dormand-Prince 5(4) field integrator constants.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/53af1473
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/53af1473
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/53af1473

Branch: refs/heads/master
Commit: 53af14730cd52af888a37c35c326d735f54c76c3
Parents: f3cdf56
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:36 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:36 2016 +0100

--
 .../ode/nonstiff/DormandPrince54FieldIntegrator.java  |  4 ++--
 .../ode/nonstiff/DormandPrince54FieldIntegratorTest.java  | 10 +-
 .../DormandPrince54FieldStepInterpolatorTest.java |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/53af1473/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegrator.java
 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegrator.java
index 743dbe4..e454ca7 100644
--- 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegrator.java
+++ 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegrator.java
@@ -134,7 +134,7 @@ public class DormandPrince54FieldIntegrator>
 final T[] c = MathArrays.buildArray(getField(), 6);
 c[0] = fraction(1,  5);
 c[1] = fraction(3, 10);
-c[2] = fraction(5,  5);
+c[2] = fraction(4,  5);
 c[3] = fraction(8,  9);
 c[4] = getField().getOne();
 c[5] = getField().getOne();
@@ -149,7 +149,7 @@ public class DormandPrince54FieldIntegrator>
 a[i] = MathArrays.buildArray(getField(), i + 1);
 }
 a[0][0] = fraction( 1, 5);
-a[1][0] = fraction( 3, 4);
+a[1][0] = fraction( 3,40);
 a[1][1] = fraction( 9,40);
 a[2][0] = fraction(44,45);
 a[2][1] = fraction(   -56,15);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/53af1473/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
index 4015ffe..9a853cd 100644
--- 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java
@@ -49,12 +49,12 @@ public class DormandPrince54FieldIntegratorTest extends 
AbstractEmbeddedRungeKut
 
 @Test
 public void testBackward() {
-doTestBackward(Decimal64Field.getInstance(), 2.0e-7, 2.0e-7, 1.0e-12, 
"Dormand-Prince 5(4)");
+doTestBackward(Decimal64Field.getInstance(), 1.6e-7, 1.6e-7, 1.0e-22, 
"Dormand-Prince 5(4)");
 }
 
 @Test
 public void testKepler() {
-doTestKepler(Decimal64Field.getInstance(), 7.0e-10);
+doTestKepler(Decimal64Field.getInstance(), 3.1e-10);
 }
 
 @Override
@@ -69,15 +69,15 @@ public class DormandPrince54FieldIntegratorTest extends 
AbstractEmbeddedRungeKut
 
 @Override
 public void testIncreasingTolerance() {
-// the 0.7 factor is only valid for this test
+// the 0.5 factor is only valid for this test
 // and has been obtained from trial and error
 // there is no general relation between local and global errors
-doTestIncreasingTolerance(Decimal64Field.getInstance(), 0.7, 1.0e-12);
+doTestIncreasingTolerance(Decimal64Field.getInstance(), 0.5, 1.0e-12);
 }
 
 @Override
 public void testEvents() {
-doTestEvents(Decimal64Field.getInstance(), 5.0e-6, "Dormand-Prince 
5(4)");
+doTestEvents(Decimal64Field.getInstance(), 3.10e-8, "Dormand-Prince 
5(4)");
 }
 
 @Override

http://git-wip-us.apache.org/repos/asf/commons-math/blob/53af1473/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldStepInterpolatorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldStepInterpolatorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldStepInterpolatorTest.java
index 9facccd..2aeac54 100644

[27/50] [abbrv] [math] Fixed syntax incompatible with Java 5.

2016-01-06 Thread luc
Fixed syntax incompatible with Java 5.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/27732156
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/27732156
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/27732156

Branch: refs/heads/master
Commit: 277321564dd18c68fce97594652d5aea50ff221c
Parents: 7a1c10a
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:40 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:40 2016 +0100

--
 .../commons/math4/ode/FieldExpandableODE.java   |  2 +-
 ...stractEmbeddedRungeKuttaFieldIntegratorTest.java | 16 
 .../AbstractRungeKuttaFieldIntegratorTest.java  | 14 +++---
 ...AbstractRungeKuttaFieldStepInterpolatorTest.java |  6 +++---
 .../ode/sampling/StepInterpolatorTestUtils.java |  2 +-
 5 files changed, 20 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/27732156/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java
--
diff --git a/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java 
b/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java
index 882f93c..2a8d6c0 100644
--- a/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java
+++ b/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java
@@ -92,7 +92,7 @@ public class FieldExpandableODE> {
 public int addSecondaryEquations(final FieldSecondaryEquations 
secondary) {
 
 components.add(secondary);
-mapper = new FieldEquationsMapper<>(mapper, secondary.getDimension());
+mapper = new FieldEquationsMapper(mapper, secondary.getDimension());
 
 return components.size() - 1;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/27732156/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
index 3f2b0be..26a7364 100644
--- 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java
@@ -151,7 +151,7 @@ public abstract class 
AbstractEmbeddedRungeKuttaFieldIntegratorTest {
 EmbeddedRungeKuttaFieldIntegrator integrator = 
createIntegrator(field, 0.0, 1.0, 1.0e-10, 1.0e-10);
 
 try  {
-integrator.integrate(new FieldExpandableODE<>(equations),
+integrator.integrate(new FieldExpandableODE(equations),
  new FieldODEState(field.getOne().negate(),
   
MathArrays.buildArray(field, 1)),
  field.getZero());
@@ -161,7 +161,7 @@ public abstract class 
AbstractEmbeddedRungeKuttaFieldIntegratorTest {
   }
 
   try  {
-  integrator.integrate(new FieldExpandableODE<>(equations),
+  integrator.integrate(new FieldExpandableODE(equations),
new FieldODEState(field.getZero(),
 
MathArrays.buildArray(field, 1)),
field.getOne());
@@ -191,7 +191,7 @@ public abstract class 
AbstractEmbeddedRungeKuttaFieldIntegratorTest {
   
vecAbsoluteTolerance, vecRelativeTolerance);
 TestFieldProblemHandler handler = new 
TestFieldProblemHandler(pb, integ);
 integ.addStepHandler(handler);
-integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), 
pb.getFinalTime());
+integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), 
pb.getFinalTime());
 Assert.fail("an exception should have been thrown");
 
 }
@@ -352,7 +352,7 @@ public abstract class 
AbstractEmbeddedRungeKuttaFieldIntegratorTest {
 EmbeddedRungeKuttaFieldIntegrator integrator = 
createIntegrator(field, 0,

pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(),

new double[4], new double[4]);
-integrator.integrate(new FieldExpandableODE<>(pb),
+integrator.integrate(new FieldE

[12/50] [abbrv] [math] Fixed Luther step interpolator error.

2016-01-06 Thread luc
Fixed Luther step interpolator error.

Now all tests related to the Luther integrator and step interpolator
pass.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/c23335ba
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/c23335ba
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/c23335ba

Branch: refs/heads/master
Commit: c23335bae449d804f21e949b220aa03c2f24f460
Parents: b5c1893
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:21 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:21 2016 +0100

--
 .../nonstiff/LutherFieldStepInterpolator.java   | 34 ++--
 .../ode/nonstiff/LutherFieldIntegratorTest.java | 16 -
 .../LutherFieldStepInterpolatorTest.java|  2 +-
 3 files changed, 26 insertions(+), 26 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/c23335ba/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolator.java
 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolator.java
index 47eef54..a5dc565 100644
--- 
a/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolator.java
+++ 
b/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolator.java
@@ -88,13 +88,13 @@ class LutherFieldStepInterpolator>
 LutherFieldStepInterpolator(final Field field, final boolean forward,
 final FieldEquationsMapper mapper) {
 super(field, forward, mapper);
-final T q = field.getOne().multiply(21).sqrt();
+final T q = field.getZero().add(21).sqrt();
 c5a = q.multiply(  -49).add(  -49);
 c5b = q.multiply(  287).add(  392);
 c5c = q.multiply( -357).add( -637);
 c5d = q.multiply(  343).add(  833);
 c6a = q.multiply(   49).add(  -49);
-c6b = q.multiply( -287).add( -392);
+c6b = q.multiply( -287).add(  392);
 c6c = q.multiply(  357).add( -637);
 c6d = q.multiply( -343).add(  833);
 d5a = q.multiply(   49).add(   49);
@@ -192,32 +192,32 @@ class LutherFieldStepInterpolator>
 final T coeffDot4 =  
theta.multiply(theta.multiply(theta.multiply(theta.multiply( -567  /  5.0).add( 
972/  5.0)).add( -486   / 5.0 )).add( 324/  25.0));
 final T coeffDot5 =  
theta.multiply(theta.multiply(theta.multiply(theta.multiply(c5a.divide(5)).add(c5b.divide(15))).add(c5c.divide(30))).add(c5d.divide(150)));
 final T coeffDot6 =  
theta.multiply(theta.multiply(theta.multiply(theta.multiply(c6a.divide(5)).add(c6b.divide(15))).add(c6c.divide(30))).add(c6d.divide(150)));
-final T coeffDot7 =  theta.multiply(theta.multiply(theta.multiply( 
 3 )).add(   -3 )).add(   3   / 
  5.0);
+final T coeffDot7 =  theta.multiply(theta.multiply(theta.multiply( 
3.0 ).add(   -3 )).add(   3   / 
  5.0));
 final T[] interpolatedState;
 final T[] interpolatedDerivatives;
 
 if (getGlobalPreviousState() != null && theta.getReal() <= 0.5) {
 
-final T s = theta.multiply(theta.multiply(h));
-final T coeff1= 
s.multiply(theta.multiply(theta.multiply(theta.multiply(  21/  5.0).add( 
-47/  4.0)).add(   12 )).add( -27/   5.0)).add(1);
+final T s = theta.multiply(h);
+final T coeff1= 
s.multiply(theta.multiply(theta.multiply(theta.multiply(theta.multiply(  21
/  5.0).add( -47/  4.0)).add(   12 )).add( -27/   5.0)).add(1));
 final T coeff2= getField().getZero();
-final T coeff3= 
s.multiply(theta.multiply(theta.multiply(theta.multiply( 112/  
5.0).add(-152/  3.0)).add(  320   / 9.0 )).add(-104/  15.0));
-final T coeff4= 
s.multiply(theta.multiply(theta.multiply(theta.multiply(-567/ 25.0).add( 
243/  5.0)).add( -162   / 5.0 )).add( 162/  25.0));
-final T coeff5= 
s.multiply(theta.multiply(theta.multiply(theta.multiply(c5a.divide(25)).add(c5b.divide(60))).add(c5c.divide(90))).add(c5d.divide(300)));
-final T coeff6= 
s.multiply(theta.multiply(theta.multiply(theta.multiply(c5a.divide(25)).add(c6b.divide(60))).add(c6c.divide(90))).add(c6d.divide(300)));
-final T coeff7= s.multiply(theta.multiply(theta.multiply(  
3/  4.0)).add(   -1 )).add(   3 
/  10.0)

[09/50] [abbrv] [math] Added test for Gill step interpolator.

2016-01-06 Thread luc
Added test for Gill step interpolator.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/ba6f4a44
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/ba6f4a44
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/ba6f4a44

Branch: refs/heads/master
Commit: ba6f4a44799a1ed0f7aea6762b658f7d5ef05f1b
Parents: 756ba33
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 12:41:17 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 12:41:17 2016 +0100

--
 .../nonstiff/GillFieldStepInterpolatorTest.java | 44 
 1 file changed, 44 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/ba6f4a44/src/test/java/org/apache/commons/math4/ode/nonstiff/GillFieldStepInterpolatorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/nonstiff/GillFieldStepInterpolatorTest.java
 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/GillFieldStepInterpolatorTest.java
new file mode 100644
index 000..3334d4f
--- /dev/null
+++ 
b/src/test/java/org/apache/commons/math4/ode/nonstiff/GillFieldStepInterpolatorTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math4.ode.nonstiff;
+
+
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.ode.FieldEquationsMapper;
+import org.apache.commons.math4.util.Decimal64Field;
+import org.junit.Test;
+
+public class GillFieldStepInterpolatorTest extends 
AbstractRungeKuttaFieldStepInterpolatorTest {
+
+protected > 
RungeKuttaFieldStepInterpolator
+createInterpolator(Field field, boolean forward, 
FieldEquationsMapper mapper) {
+return new GillFieldStepInterpolator(field, forward, mapper);
+}
+
+@Test
+public void interpolationAtBounds() {
+doInterpolationAtBounds(Decimal64Field.getInstance(), 1.0e-15);
+}
+
+@Test
+public void interpolationInside() {
+doInterpolationInside(Decimal64Field.getInstance(), 2.6e-7, 3.6e-6);
+}
+
+}



[35/50] [abbrv] [math] Fixed syntax not compatible with Java 5.

2016-01-06 Thread luc
Fixed syntax not compatible with Java 5.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/1d4d89e9
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/1d4d89e9
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/1d4d89e9

Branch: refs/heads/master
Commit: 1d4d89e9fb191af54a8f2eac924a2fcb285f760b
Parents: 49747dc
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 13:30:12 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 13:30:12 2016 +0100

--
 .../math4/ode/FieldExpandableODETest.java   | 344 +++
 .../ode/nonstiff/FieldExpandableODETest.java| 344 ---
 2 files changed, 344 insertions(+), 344 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/1d4d89e9/src/test/java/org/apache/commons/math4/ode/FieldExpandableODETest.java
--
diff --git 
a/src/test/java/org/apache/commons/math4/ode/FieldExpandableODETest.java 
b/src/test/java/org/apache/commons/math4/ode/FieldExpandableODETest.java
new file mode 100644
index 000..8005274
--- /dev/null
+++ b/src/test/java/org/apache/commons/math4/ode/FieldExpandableODETest.java
@@ -0,0 +1,344 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math4.ode;
+
+
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.ode.FieldExpandableODE;
+import org.apache.commons.math4.ode.FieldFirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.FieldODEStateAndDerivative;
+import org.apache.commons.math4.ode.FieldSecondaryEquations;
+import org.apache.commons.math4.util.Decimal64Field;
+import org.apache.commons.math4.util.MathArrays;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class FieldExpandableODETest {
+
+@Test
+public void testOnlyMainEquation() {
+doTestOnlyMainEquation(Decimal64Field.getInstance());
+}
+
+private > void doTestOnlyMainEquation(final 
Field field) {
+FieldFirstOrderDifferentialEquations main = new Linear(field, 3, 
0);
+FieldExpandableODE equation = new FieldExpandableODE(main);
+Assert.assertEquals(main.getDimension(), 
equation.getMapper().getTotalDimension());
+Assert.assertEquals(1, equation.getMapper().getNumberOfEquations());
+T t0 = field.getZero().add(10);
+T t  = field.getZero().add(100);
+T[] complete= MathArrays.buildArray(field, 
equation.getMapper().getTotalDimension());
+for (int i = 0; i < complete.length; ++i) {
+complete[i] = field.getZero().add(i);
+}
+equation.init(t0, complete, t);
+T[] completeDot = equation.computeDerivatives(t0, complete);
+FieldODEStateAndDerivative state = 
equation.getMapper().mapStateAndDerivative(t0, complete, completeDot);
+Assert.assertEquals(0, state.getNumberOfSecondaryStates());
+T[] mainState= state.getState();
+T[] mainStateDot = state.getDerivative();
+Assert.assertEquals(main.getDimension(), mainState.length);
+for (int i = 0; i < main.getDimension(); ++i) {
+Assert.assertEquals(i, mainState[i].getReal(),   1.0e-15);
+Assert.assertEquals(i, mainStateDot[i].getReal(), 1.0e-15);
+Assert.assertEquals(i, completeDot[i].getReal(),  1.0e-15);
+}
+}
+
+@Test
+public void testMainAndSecondary() {
+doTestMainAndSecondary(Decimal64Field.getInstance());
+}
+
+private > void doTestMainAndSecondary(final 
Field field) {
+
+FieldFirstOrderDifferentialEquations main = new Linear(field, 3, 
0);
+FieldExpandableODE equation = new FieldExpandableODE(main);
+FieldSeconda

[40/50] [abbrv] [math] Avoid protected fields.

2016-01-06 Thread luc
Avoid protected fields.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/355b55e4
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/355b55e4
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/355b55e4

Branch: refs/heads/master
Commit: 355b55e4c6fa22a98983b745579c43077cc387b6
Parents: 346a81d
Author: Luc Maisonobe <l...@apache.org>
Authored: Wed Jan 6 14:17:44 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Wed Jan 6 14:17:44 2016 +0100

--
 .../math4/ode/AbstractFieldIntegrator.java  | 61 ++--
 .../commons/math4/ode/AbstractIntegrator.java   |  1 +
 .../AdaptiveStepsizeFieldIntegrator.java|  4 +-
 .../EmbeddedRungeKuttaFieldIntegrator.java  | 50 
 .../ode/nonstiff/RungeKuttaFieldIntegrator.java | 46 +++
 5 files changed, 108 insertions(+), 54 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/355b55e4/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
--
diff --git 
a/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java 
b/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
index 41d7f15..c61da98 100644
--- a/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java
@@ -56,16 +56,19 @@ public abstract class AbstractFieldIntegrator> imp
 private static final double DEFAULT_FUNCTION_VALUE_ACCURACY = 1e-15;
 
 /** Step handler. */
-protected Collection<FieldStepHandler> stepHandlers;
+private Collection<FieldStepHandler> stepHandlers;
 
 /** Current step start. */
-protected FieldODEStateAndDerivative stepStart;
+private FieldODEStateAndDerivative stepStart;
 
 /** Current stepsize. */
-protected T stepSize;
+private T stepSize;
 
 /** Indicator for last step. */
-protected boolean isLastStep;
+private boolean isLastStep;
+
+/** Indicator that a state or derivative reset was triggered by some 
event. */
+private boolean resetOccurred;
 
 /** Field to which the time and state vector elements belong. */
 private final Field field;
@@ -352,6 +355,7 @@ public abstract class AbstractFieldIntegrator> imp
 }
 
 FieldODEState newState = null;
+resetOccurred = false;
 for (final FieldEventState state : eventsStates) {
 newState = state.reset(eventState);
 if (newState != null) {
@@ -359,6 +363,7 @@ public abstract class AbstractFieldIntegrator> imp
 // invalidate the derivatives, we need to recompute 
them
 final T[] y= 
equations.getMapper().mapState(newState);
 final T[] yDot = 
computeDerivatives(newState.getTime(), y);
+resetOccurred = true;
 return 
equations.getMapper().mapStateAndDerivative(newState.getTime(), y, yDot);
 }
 }
@@ -411,4 +416,52 @@ public abstract class AbstractFieldIntegrator> imp
 
 }
 
+/** Check if a reset occurred while last step was accepted.
+ * @return true if a reset occurred while last step was accepted
+ */
+protected boolean resetOccurred() {
+return resetOccurred;
+}
+
+/** Set the current step size.
+ * @param stepSize step size to set
+ */
+protected void setStepSize(final T stepSize) {
+this.stepSize = stepSize;
+}
+
+/** Get the current step size.
+ * @return current step size
+ */
+protected T getStepSize() {
+return stepSize;
+}
+/** Set current step start.
+ * @param stepStart step start
+ */
+protected void setStepStart(final FieldODEStateAndDerivative stepStart) 
{
+this.stepStart = stepStart;
+}
+
+/** Getcurrent step start.
+ * @return current step start
+ */
+protected FieldODEStateAndDerivative getStepStart() {
+return stepStart;
+}
+
+/** Set the last state flag.
+ * @param isLastStep if true, this step is the last one
+ */
+protected void setIsLastStep(final boolean isLastStep) {
+this.isLastStep = isLastStep;
+}
+
+/** Check if this step is the last one.
+ * @return true if this step is the last one
+ */
+protected boolean isLastStep() {
+return isLastStep;
+}
+
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/355b55e4/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java

svn commit: r11823 - /dev/commons/math/ /dev/commons/math/binaries/ /dev/commons/math/source/ /release/commons/math/ /release/commons/math/binaries/ /release/commons/math/source/

2016-01-05 Thread luc
Author: luc
Date: Tue Jan  5 20:32:23 2016
New Revision: 11823

Log:
Publish commons-math 3.6 Release

Added:
release/commons/math/README.html
  - copied unchanged from r11822, dev/commons/math/README.html
release/commons/math/RELEASE-NOTES.txt
  - copied unchanged from r11822, dev/commons/math/RELEASE-NOTES.txt
release/commons/math/binaries/commons-math3-3.6-bin.tar.gz
  - copied unchanged from r11822, 
dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz
release/commons/math/binaries/commons-math3-3.6-bin.tar.gz.asc
  - copied unchanged from r11822, 
dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz.asc
release/commons/math/binaries/commons-math3-3.6-bin.tar.gz.md5
  - copied unchanged from r11822, 
dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz.md5
release/commons/math/binaries/commons-math3-3.6-bin.tar.gz.sha1
  - copied unchanged from r11822, 
dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz.sha1
release/commons/math/binaries/commons-math3-3.6-bin.zip
  - copied unchanged from r11822, 
dev/commons/math/binaries/commons-math3-3.6-bin.zip
release/commons/math/binaries/commons-math3-3.6-bin.zip.asc
  - copied unchanged from r11822, 
dev/commons/math/binaries/commons-math3-3.6-bin.zip.asc
release/commons/math/binaries/commons-math3-3.6-bin.zip.md5
  - copied unchanged from r11822, 
dev/commons/math/binaries/commons-math3-3.6-bin.zip.md5
release/commons/math/binaries/commons-math3-3.6-bin.zip.sha1
  - copied unchanged from r11822, 
dev/commons/math/binaries/commons-math3-3.6-bin.zip.sha1
release/commons/math/source/commons-math3-3.6-src.tar.gz
  - copied unchanged from r11822, 
dev/commons/math/source/commons-math3-3.6-src.tar.gz
release/commons/math/source/commons-math3-3.6-src.tar.gz.asc
  - copied unchanged from r11822, 
dev/commons/math/source/commons-math3-3.6-src.tar.gz.asc
release/commons/math/source/commons-math3-3.6-src.tar.gz.md5
  - copied unchanged from r11822, 
dev/commons/math/source/commons-math3-3.6-src.tar.gz.md5
release/commons/math/source/commons-math3-3.6-src.tar.gz.sha1
  - copied unchanged from r11822, 
dev/commons/math/source/commons-math3-3.6-src.tar.gz.sha1
release/commons/math/source/commons-math3-3.6-src.zip
  - copied unchanged from r11822, 
dev/commons/math/source/commons-math3-3.6-src.zip
release/commons/math/source/commons-math3-3.6-src.zip.asc
  - copied unchanged from r11822, 
dev/commons/math/source/commons-math3-3.6-src.zip.asc
release/commons/math/source/commons-math3-3.6-src.zip.md5
  - copied unchanged from r11822, 
dev/commons/math/source/commons-math3-3.6-src.zip.md5
release/commons/math/source/commons-math3-3.6-src.zip.sha1
  - copied unchanged from r11822, 
dev/commons/math/source/commons-math3-3.6-src.zip.sha1
Removed:
dev/commons/math/README.html
dev/commons/math/RELEASE-NOTES.txt
dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz
dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz.asc
dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz.md5
dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz.sha1
dev/commons/math/binaries/commons-math3-3.6-bin.zip
dev/commons/math/binaries/commons-math3-3.6-bin.zip.asc
dev/commons/math/binaries/commons-math3-3.6-bin.zip.md5
dev/commons/math/binaries/commons-math3-3.6-bin.zip.sha1
dev/commons/math/source/commons-math3-3.6-src.tar.gz
dev/commons/math/source/commons-math3-3.6-src.tar.gz.asc
dev/commons/math/source/commons-math3-3.6-src.tar.gz.md5
dev/commons/math/source/commons-math3-3.6-src.tar.gz.sha1
dev/commons/math/source/commons-math3-3.6-src.zip
dev/commons/math/source/commons-math3-3.6-src.zip.asc
dev/commons/math/source/commons-math3-3.6-src.zip.md5
dev/commons/math/source/commons-math3-3.6-src.zip.sha1



[commons-math] Git Push Summary

2016-01-05 Thread luc
Repository: commons-math
Updated Tags:  refs/tags/MATH_3_6 [created] bfc732eae


[2/7] [math] Updated download page in preparation for 3.6 release.

2016-01-05 Thread luc
Updated download page in preparation for 3.6 release.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/e3eb0f65
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/e3eb0f65
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/e3eb0f65

Branch: refs/heads/MATH_3_X
Commit: e3eb0f65f0ba89cb427104e6e0a809a773c33e69
Parents: e7e5406
Author: Luc Maisonobe <l...@apache.org>
Authored: Fri Jan 1 13:29:49 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Fri Jan 1 15:13:23 2016 +0100

--
 src/site/xdoc/download_math.xml | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/e3eb0f65/src/site/xdoc/download_math.xml
--
diff --git a/src/site/xdoc/download_math.xml b/src/site/xdoc/download_math.xml
index 3e6a093..124cdac 100644
--- a/src/site/xdoc/download_math.xml
+++ b/src/site/xdoc/download_math.xml
@@ -95,32 +95,32 @@ limitations under the License.
   
 
 
-
+
   
 
   
-  commons-math3-3.5-bin.tar.gz
-  http://www.apache.org/dist/commons/math/binaries/commons-math3-3.5-bin.tar.gz.md5;>md5
-  http://www.apache.org/dist/commons/math/binaries/commons-math3-3.5-bin.tar.gz.asc;>pgp
+  commons-math3-3.6-bin.tar.gz
+  http://www.apache.org/dist/commons/math/binaries/commons-math3-3.6-bin.tar.gz.md5;>md5
+  http://www.apache.org/dist/commons/math/binaries/commons-math3-3.6-bin.tar.gz.asc;>pgp
   
   
-  commons-math3-3.5-bin.zip
-  http://www.apache.org/dist/commons/math/binaries/commons-math3-3.5-bin.zip.md5;>md5
-  http://www.apache.org/dist/commons/math/binaries/commons-math3-3.5-bin.zip.asc;>pgp
+  commons-math3-3.6-bin.zip
+  http://www.apache.org/dist/commons/math/binaries/commons-math3-3.6-bin.zip.md5;>md5
+  http://www.apache.org/dist/commons/math/binaries/commons-math3-3.6-bin.zip.asc;>pgp
   
 
   
   
 
   
-  commons-math3-3.5-src.tar.gz
-  http://www.apache.org/dist/commons/math/source/commons-math3-3.5-src.tar.gz.md5;>md5
-  http://www.apache.org/dist/commons/math/source/commons-math3-3.5-src.tar.gz.asc;>pgp
+  commons-math3-3.6-src.tar.gz
+  http://www.apache.org/dist/commons/math/source/commons-math3-3.6-src.tar.gz.md5;>md5
+  http://www.apache.org/dist/commons/math/source/commons-math3-3.6-src.tar.gz.asc;>pgp
   
   
-  commons-math3-3.5-src.zip
-  http://www.apache.org/dist/commons/math/source/commons-math3-3.5-src.zip.md5;>md5
-  http://www.apache.org/dist/commons/math/source/commons-math3-3.5-src.zip.asc;>pgp
+  commons-math3-3.6-src.zip
+  http://www.apache.org/dist/commons/math/source/commons-math3-3.6-src.zip.md5;>md5
+  http://www.apache.org/dist/commons/math/source/commons-math3-3.6-src.zip.asc;>pgp
   
 
   



[4/7] [math] Added release notes for 3.6.

2016-01-05 Thread luc
Added release notes for 3.6.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/9df79570
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/9df79570
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/9df79570

Branch: refs/heads/MATH_3_X
Commit: 9df79570ae9415ff1a17f0fe6f280f17303e7e51
Parents: e3eb0f6
Author: Luc Maisonobe <l...@apache.org>
Authored: Fri Jan 1 13:52:16 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Fri Jan 1 15:13:23 2016 +0100

--
 RELEASE-NOTES.txt   | 117 ---
 src/changes/changes.xml |  28 ++-
 2 files changed, 126 insertions(+), 19 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/9df79570/RELEASE-NOTES.txt
--
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 6a6ac4e..56e8d19 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -1,4 +1,4 @@
-The Apache Commons Math team is pleased to announce the commons-math3-3.5 
release!
+The Apache Commons Math team is pleased to announce the commons-math3-3.6 
release!
 
 The Apache Commons Math project is a library of lightweight, self-contained 
mathematics
 and statistics components addressing the most common practical problems not 
immediately
@@ -7,27 +7,108 @@ available in the Java programming language or commons-lang.
 Changes in this version include:
 
 New features:
-o Added a way to build polyhedrons sets from a list of vertices and
-facets specified using vertices indices. 
-o Simplified "FastMath#exp(double)" in order to avoid a potential
-Java 1.5 JIT bug when calling with negative infinity as argument.  
Issue: MATH-1198. 
-o Added method "getQuadraticMean()" to "DescriptiveStatistics"
-and "SummaryStatistics" which calculates the root mean square.  Issue: 
MATH-1199. 
+o Added a RotationConvention enumerate to allow specifying the semantics
+or axis/angle for rotations. This enumerate has two values:
+VECTOR_OPERATOR and FRAME_TRANSFORM.  Issue: MATH-1302,MATH-1303.
+o Added a field-based version of Ordinary Differential Equations framework.
+This allows integrating ode that refer to RealField elements instead of
+primitive double, hence opening the way to use DerivativeStructure to
+compute partial differential without using variational equations, or 
to solve
+ode with extended precision using Dfp.  Issue: MATH-1288.
+o Added a nth order Brent solver for general real fields, replacing the former
+solver that was restricted to Dfp fields only.
+o New "Range" inner class of "o.a.c.m.util.IntegerSequence".  Issue: MATH-1286.
+o "AggregateSummaryStatistics" can now aggregate any kind of
+"StatisticalSummary".  Issue: MATH-837.
+o Deep copy of "Network" (package "o.a.c.m.ml.neuralnet") to allow evaluation 
of
+of intermediate states during training.  Issue: MATH-1278.
+o Added negative zero support in FastMath.pow.  Issue: MATH-1273. Thanks to 
Qualtagh.
+o Various SOFM visualizations (in package "o.a.c.m.ml.neuralnet.twod.util"):
+Unified distance matrix, hit histogram, smoothed data histograms,
+topographic error, quantization error.  Issue: MATH-1270.
+o New interfaces to be implemented by algorithms that visualizes properties
+of a "NeuronSquareMesh2D" (package "o.a.c.m.ml.neuralnet.twod.util").  
Issue: MATH-1268.
+o Reimplemented pow(double, double) in FastMath, for better accuracy in
+integral power cases and trying to fix erroneous JIT optimization 
again.
+o Added a pow(double, long) method in FastMath.
+o "NeuronSquareMesh2D" (package "o.a.c.m.ml.neuralnet.twod") implements 
"Iterable".  Issue: MATH-1265.
+o "MapUtils" (package "o.a.c.m.ml.neuralnet"): Method to sort units according 
to distance
+from a given vector.  Issue: MATH-1264.
+o Accessor (class "o.a.c.m.ml.neuralnet.twod.NeuronSquareMesh2D").  Issue: 
MATH-1263.
+o New "IntegerSequence" class (in package "o.a.c.m.util") with "Incrementor" 
inner class.  Issue: MATH-1259.
+o "Neuron" class (package "o.a.c.m.ml.neuralnet"): added methods that can be 
used
+to assess concurrency performance.  Issue: MATH-1250.
+o Method "cosAngle" in "o.a.c.m.util.MathArrays".  Issue: MATH-1244.
 
 Fixed Bugs:
-o Moved FastMathTestPerformance out of the main test tree, as is is
-a benchmark rather than a test.  Issue: MATH-1195. 
-o Fixed ignored method par

[5/7] [math] Merge branch 'MATH_3_X' into 3.6-release

2016-01-05 Thread luc
Merge branch 'MATH_3_X' into 3.6-release

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/47ae2b7c
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/47ae2b7c
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/47ae2b7c

Branch: refs/heads/MATH_3_X
Commit: 47ae2b7c84fba9f4dd857b7c70941ec2ef7e6f39
Parents: 2525399 026e330
Author: Luc Maisonobe <l...@apache.org>
Authored: Sat Jan 2 19:53:12 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sat Jan 2 19:53:12 2016 +0100

--
 build.xml   |  23 +-
 doc/release/release.howto.txt   |  21 +-
 .../apache/commons/math3/complex/Complex.java   | 154 ++---
 .../math3/random/BitsStreamGenerator.java   |   1 -
 .../apache/commons/math3/util/Precision.java|  39 +-
 src/site/xdoc/userguide/stat.xml|   9 +-
 .../commons/math3/complex/ComplexTest.java  |  18 +
 .../EnumeratedIntegerDistributionTest.java  |   5 +-
 .../AbstractAdamsFieldIntegratorTest.java   | 260 
 ...ctEmbeddedRungeKuttaFieldIntegratorTest.java | 600 -
 .../AbstractRungeKuttaFieldIntegratorTest.java  | 662 ---
 ...ractRungeKuttaFieldStepInterpolatorTest.java | 305 -
 .../AdamsBashforthFieldIntegratorTest.java  |   2 +-
 .../AdamsFieldIntegratorAbstractTest.java   | 260 
 .../AdamsMoultonFieldIntegratorTest.java|   2 +-
 ...sicalRungKuttaFieldStepInterpolatorTest.java |   2 +-
 .../ClassicalRungeKuttaFieldIntegratorTest.java |   2 +-
 .../DormandPrince54FieldIntegratorTest.java |   2 +-
 ...ormandPrince54FieldStepInterpolatorTest.java |   2 +-
 .../DormandPrince853FieldIntegratorTest.java|   2 +-
 ...rmandPrince853FieldStepInterpolatorTest.java |   2 +-
 ...edRungeKuttaFieldIntegratorAbstractTest.java | 600 +
 .../ode/nonstiff/EulerFieldIntegratorTest.java  |   2 +-
 .../EulerFieldStepInterpolatorTest.java |   2 +-
 .../ode/nonstiff/GillFieldIntegratorTest.java   |   2 +-
 .../nonstiff/GillFieldStepInterpolatorTest.java |   2 +-
 .../HighamHall54FieldIntegratorTest.java|   2 +-
 .../HighamHall54FieldStepInterpolatorTest.java  |   2 +-
 .../ode/nonstiff/LutherFieldIntegratorTest.java |   2 +-
 .../LutherFieldStepInterpolatorTest.java|   2 +-
 .../nonstiff/MidpointFieldIntegratorTest.java   |   2 +-
 .../MidpointFieldStepInterpolatorTest.java  |   2 +-
 .../RungeKuttaFieldIntegratorAbstractTest.java  | 662 +++
 ...eKuttaFieldStepInterpolatorAbstractTest.java | 305 +
 .../ThreeEighthesFieldIntegratorTest.java   |   2 +-
 .../ThreeEighthesFieldStepInterpolatorTest.java |   2 +-
 test-jar.xml|  50 +-
 37 files changed, 2006 insertions(+), 2008 deletions(-)
--




[7/7] [math] Putting MATH_3_X branch to post-release state.

2016-01-05 Thread luc
Putting MATH_3_X branch to post-release state.

This change is only done in case a new release should be done.
This is however not really expected now and the next release should
rather be 4.0 than 3.7.

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/838788fd
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/838788fd
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/838788fd

Branch: refs/heads/MATH_3_X
Commit: 838788fd6302d6cc91e1743144e0f14b71e4812e
Parents: 95a9d35
Author: Luc Maisonobe <l...@apache.org>
Authored: Tue Jan 5 22:46:13 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Tue Jan 5 22:46:13 2016 +0100

--
 doap_math.rdf   | 5 +
 pom.xml | 2 +-
 src/changes/changes.xml | 2 ++
 3 files changed, 8 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/838788fd/doap_math.rdf
--
diff --git a/doap_math.rdf b/doap_math.rdf
index a728234..077eb81 100644
--- a/doap_math.rdf
+++ b/doap_math.rdf
@@ -38,6 +38,11 @@
 
   
 commons-math
+2016-01-05
+3.6
+  
+  
+commons-math
 2015-04-17
 3.5
   

http://git-wip-us.apache.org/repos/asf/commons-math/blob/838788fd/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 3705a86..4153bff 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
   4.0.0
   org.apache.commons
   commons-math3
-  3.6
+  3.7-SNAPSHOT
   Apache Commons Math
 
   2003

http://git-wip-us.apache.org/repos/asf/commons-math/blob/838788fd/src/changes/changes.xml
--
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 21ab68f..d9a8b46 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -50,6 +50,8 @@ If the output is not quite correct, check for invisible 
trailing spaces!
 Commons Math Release Notes
   
   
+
+
 

[3/7] [math] preparing pom for 3.6 release.

2016-01-05 Thread luc
preparing pom for 3.6 release.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/e7e54063
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/e7e54063
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/e7e54063

Branch: refs/heads/MATH_3_X
Commit: e7e5406342ed8302c847e771cd453e3036220e52
Parents: d70c566
Author: Luc Maisonobe <l...@apache.org>
Authored: Fri Jan 1 13:28:00 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Fri Jan 1 15:13:23 2016 +0100

--
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/e7e54063/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 302107f..edeacf3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
   4.0.0
   org.apache.commons
   commons-math3
-  3.6-SNAPSHOT
+  3.6
   Apache Commons Math
 
   2003
@@ -374,9 +374,9 @@
 
 
org.apache.commons.math3
 
-3.5
+3.6
 (requires Java 1.5+)
-
+RC1
 -bin
 
 2.2



[6/7] [math] Preparing release candidate 2 for Apache Commons Math 3.6.

2016-01-05 Thread luc
Preparing release candidate 2 for Apache Commons Math 3.6.

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/95a9d35e
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/95a9d35e
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/95a9d35e

Branch: refs/heads/MATH_3_X
Commit: 95a9d35e77f70ffc9bd5143880c236a760b42005
Parents: 47ae2b7
Author: Luc Maisonobe <l...@apache.org>
Authored: Sat Jan 2 19:56:59 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sat Jan 2 19:56:59 2016 +0100

--
 pom.xml | 2 +-
 src/changes/changes.xml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/95a9d35e/pom.xml
--
diff --git a/pom.xml b/pom.xml
index edeacf3..3705a86 100644
--- a/pom.xml
+++ b/pom.xml
@@ -376,7 +376,7 @@
 
 3.6
 (requires Java 1.5+)
-RC1
+RC2
 -bin
 
 2.2

http://git-wip-us.apache.org/repos/asf/commons-math/blob/95a9d35e/src/changes/changes.xml
--
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 90e8dc9..21ab68f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -50,7 +50,7 @@ If the output is not quite correct, check for invisible 
trailing spaces!
 Commons Math Release Notes
   
   
-

[1/7] [math] added link for 3.6 javadoc.

2016-01-05 Thread luc
Repository: commons-math
Updated Branches:
  refs/heads/MATH_3_X 026e33053 -> 838788fd6


added link for 3.6 javadoc.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/2525399e
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/2525399e
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/2525399e

Branch: refs/heads/MATH_3_X
Commit: 2525399e1654530f1eff026cf3a16e473cd07296
Parents: 9df7957
Author: Luc Maisonobe <l...@apache.org>
Authored: Fri Jan 1 14:41:25 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Fri Jan 1 15:13:23 2016 +0100

--
 src/site/site.xml | 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/2525399e/src/site/site.xml
--
diff --git a/src/site/site.xml b/src/site/site.xml
index b6e0f7a..b9adbf4 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -27,6 +27,8 @@
   
   http://commons.apache.org/math/download_math.cgi"/>
   
+  http://commons.apache.org/math/javadocs/api-3.6/index.html"/>
   http://commons.apache.org/math/javadocs/api-3.5/index.html"/>
   

[math] Inserting 3.6 into changes history.

2016-01-05 Thread luc
Repository: commons-math
Updated Branches:
  refs/heads/master bd557f1b8 -> 7e1c299da


Inserting 3.6 into changes history.

The actions that were tagged in 4.0 as "backported in 3.6" because they
were present in both master and MATH_3_X branch have been removed from
the 4.0 specific changes as they already appear below in the 3.6
specific changes.

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/7e1c299d
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/7e1c299d
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/7e1c299d

Branch: refs/heads/master
Commit: 7e1c299da29a3e8f7a5f3feab5c69fe46f61ec27
Parents: bd557f1
Author: Luc Maisonobe <l...@apache.org>
Authored: Tue Jan 5 23:00:26 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Tue Jan 5 23:03:27 2016 +0100

--
 src/changes/changes.xml | 440 +++
 1 file changed, 240 insertions(+), 200 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/7e1c299d/src/changes/changes.xml
--
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index f56b0a2..881cf52 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -54,9 +54,6 @@ If the output is not quite correct, check for invisible 
trailing spaces!
 
 
 
-   
-Improved performance and accuracy of 2-sample KolmogorovSmirnov tests.
-  
   
 Removed obsolete class "AbstractRandomGenerator" (package 
"o.a.c.m.random").
   
@@ -72,20 +69,6 @@ If the output is not quite correct, check for invisible 
trailing spaces!
 "BitsStreamGenerator" whose method "nextInt(int)" is replaced by 
"nextInt()"
 as the generator of randomness that must be implemented in concrete 
subclasses.
   
-   
-Detect start failures with multi-step ODE integrators.
-  
-   
-Added a RotationConvention enumerate to allow specifying the semantics
-or axis/angle for rotations. This enumerate has two values:
-VECTOR_OPERATOR and FRAME_TRANSFORM.
-  
-   
-Fixed stability issues with Adams-Bashforth and Adams-Moulton ODE 
integrators.
-The integrators did not estimate the local error properly and were 
sometimes
-stuck attempting to reduce indefinitely the step size as they thought 
the
-error was too high.
-  
   
 "JDKRandomGenerator": Method "nextInt(int)" now throws a 
"NotStrictlyPositiveException".
 The class now delegates to (rather inherits from) "java.util.Random".
@@ -103,139 +86,307 @@ If the output is not quite correct, check for invisible 
trailing spaces!
 "FactorialLog": Cache-based computation of the "log factorial" 
function (implemented
 as an inner class of "CombinatoricsUtils" in package "o.a.c.m.util").
   
-   

+  
+Added divideUnsigned and remainderUnsigned to ArithmeticUtils.
+  
+  
+Lifted unnecessary restriction on constructor's argument of
+"MicrosphereInterpolator" (package "o.a.c.m.analysis.interpolation").
+  
+  
+The "SimplexSolver" will now throw a "DimensionMismatchException"
+when calling "optimize(...)" with linear constraints whose dimension
+does not match the dimension of the objective function.
+  
+  
+Added a fast implementation of IEEEremainder in FastMath.
+  
+  
+Use Double.isNaN rather than x != x in FastMath.
+  
+  
+Added helper methods to FunctionUtils for univariate and multivariate 
differentiable functions conversion.
+  
+  
+Removed unused package private class PollardRho in package primes.
+  
+  
+Improve performance of "ZipfDistribution" by caching the nth 
generalized harmonic.
+  
+  
+"MathRuntimeException" is now the base class for all commons-math
+exceptions (except for "NullArgumentException" which extends
+"NullPointerException").
+  
+  
+Removed methods "test(...)" from "AbstractUnivariateStatistic".
+The already existing methods "MathArrays#verifyValues(...)" shall
+be used instead.
+  
+  
+The abstract class "AbstractStorelessUnivariateStatistic" does not
+extend anymore from "AbstractUnivariateStatistic".
+  
+

[4/4] [math] Merge branch 'MATH_3_X' of https://l...@git-wip-us.apache.org/repos/asf/commons-math.git into MATH_3_X

2016-01-02 Thread luc
Merge branch 'MATH_3_X' of 
https://l...@git-wip-us.apache.org/repos/asf/commons-math.git into MATH_3_X

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/c5e6ccb8
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/c5e6ccb8
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/c5e6ccb8

Branch: refs/heads/MATH_3_X
Commit: c5e6ccb81771a2ad82d4c4ff02edb73c2cd18184
Parents: 2964995 895e9c1
Author: Luc Maisonobe <l...@apache.org>
Authored: Sat Jan 2 10:28:21 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sat Jan 2 10:28:21 2016 +0100

--
 .../apache/commons/math3/complex/Complex.java   | 154 ---
 .../apache/commons/math3/util/Precision.java|  39 +++--
 .../commons/math3/complex/ComplexTest.java  |  18 +++
 3 files changed, 108 insertions(+), 103 deletions(-)
--




[1/4] [math] Renamed abstract test classes to match build environment filters.

2016-01-02 Thread luc
Repository: commons-math
Updated Branches:
  refs/heads/MATH_3_X 895e9c1c5 -> c5e6ccb81


http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegratorAbstractTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegratorAbstractTest.java
 
b/src/test/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegratorAbstractTest.java
new file mode 100644
index 000..518690a
--- /dev/null
+++ 
b/src/test/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegratorAbstractTest.java
@@ -0,0 +1,662 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math3.ode.nonstiff;
+
+
+import java.lang.reflect.Array;
+
+import org.apache.commons.math3.Field;
+import org.apache.commons.math3.RealFieldElement;
+import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math3.exception.NoBracketingException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math3.ode.FieldExpandableODE;
+import org.apache.commons.math3.ode.FirstOrderFieldDifferentialEquations;
+import org.apache.commons.math3.ode.FieldODEState;
+import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
+import org.apache.commons.math3.ode.TestFieldProblem1;
+import org.apache.commons.math3.ode.TestFieldProblem2;
+import org.apache.commons.math3.ode.TestFieldProblem3;
+import org.apache.commons.math3.ode.TestFieldProblem4;
+import org.apache.commons.math3.ode.TestFieldProblem5;
+import org.apache.commons.math3.ode.TestFieldProblem6;
+import org.apache.commons.math3.ode.TestFieldProblemAbstract;
+import org.apache.commons.math3.ode.TestFieldProblemHandler;
+import org.apache.commons.math3.ode.events.Action;
+import org.apache.commons.math3.ode.events.FieldEventHandler;
+import org.apache.commons.math3.ode.sampling.FieldStepHandler;
+import org.apache.commons.math3.ode.sampling.FieldStepInterpolator;
+import org.apache.commons.math3.ode.sampling.StepInterpolatorTestUtils;
+import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math3.util.MathArrays;
+import org.junit.Assert;
+import org.junit.Test;
+
+public abstract class RungeKuttaFieldIntegratorAbstractTest {
+
+protected abstract > 
RungeKuttaFieldIntegrator
+createIntegrator(Field field, T step);
+
+@Test
+public abstract void testNonFieldIntegratorConsistency();
+
+protected > void 
doTestNonFieldIntegratorConsistency(final Field field) {
+try {
+
+// get the Butcher arrays from the field integrator
+RungeKuttaFieldIntegrator fieldIntegrator = 
createIntegrator(field, field.getZero().add(1));
+T[][] fieldA = fieldIntegrator.getA();
+T[]   fieldB = fieldIntegrator.getB();
+T[]   fieldC = fieldIntegrator.getC();
+
+String fieldName   = fieldIntegrator.getClass().getName();
+String regularName = fieldName.replaceAll("Field", "");
+
+// get the Butcher arrays from the regular integrator
+@SuppressWarnings("unchecked")
+Class c = (Class) 
Class.forName(regularName);
+java.lang.reflect.Field jlrFieldA = c.getDeclaredField("STATIC_A");
+jlrFieldA.setAccessible(true);
+double[][] regularA = (double[][]) jlrFieldA.get(null);
+java.lang.reflect.Field jlrFieldB = c.getDeclaredField("STATIC_B");
+jlrFieldB.setAccessible(true);
+double[]   regularB = (double[])   jlrFieldB.get(null);
+java.lang.reflect.Field jlrFieldC = c.getDeclaredField("STATIC_C");
+jlrFieldC.setAccessible(true);
+double[]   regularC = (double[])   jlrFieldC.get(null);
+
+Assert.assertEquals(regularA.length, fieldA.length);
+for (int i = 0; i < regularA.length; ++i) {
+checkArray(regularA[i], fieldA[i]);
+ 

[3/4] [math] Renamed abstract test classes to match build environment filters.

2016-01-02 Thread luc
Renamed abstract test classes to match build environment filters.

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/29649959
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/29649959
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/29649959

Branch: refs/heads/MATH_3_X
Commit: 29649959e22888a0814541acc01f9ca8d86aaa72
Parents: 445f091
Author: Luc Maisonobe <l...@apache.org>
Authored: Sat Jan 2 10:27:49 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sat Jan 2 10:27:49 2016 +0100

--
 .../AbstractAdamsFieldIntegratorTest.java   | 260 
 ...ctEmbeddedRungeKuttaFieldIntegratorTest.java | 600 -
 .../AbstractRungeKuttaFieldIntegratorTest.java  | 662 ---
 ...ractRungeKuttaFieldStepInterpolatorTest.java | 305 -
 .../AdamsBashforthFieldIntegratorTest.java  |   2 +-
 .../AdamsFieldIntegratorAbstractTest.java   | 260 
 .../AdamsMoultonFieldIntegratorTest.java|   2 +-
 ...sicalRungKuttaFieldStepInterpolatorTest.java |   2 +-
 .../ClassicalRungeKuttaFieldIntegratorTest.java |   2 +-
 .../DormandPrince54FieldIntegratorTest.java |   2 +-
 ...ormandPrince54FieldStepInterpolatorTest.java |   2 +-
 .../DormandPrince853FieldIntegratorTest.java|   2 +-
 ...rmandPrince853FieldStepInterpolatorTest.java |   2 +-
 ...edRungeKuttaFieldIntegratorAbstractTest.java | 600 +
 .../ode/nonstiff/EulerFieldIntegratorTest.java  |   2 +-
 .../EulerFieldStepInterpolatorTest.java |   2 +-
 .../ode/nonstiff/GillFieldIntegratorTest.java   |   2 +-
 .../nonstiff/GillFieldStepInterpolatorTest.java |   2 +-
 .../HighamHall54FieldIntegratorTest.java|   2 +-
 .../HighamHall54FieldStepInterpolatorTest.java  |   2 +-
 .../ode/nonstiff/LutherFieldIntegratorTest.java |   2 +-
 .../LutherFieldStepInterpolatorTest.java|   2 +-
 .../nonstiff/MidpointFieldIntegratorTest.java   |   2 +-
 .../MidpointFieldStepInterpolatorTest.java  |   2 +-
 .../RungeKuttaFieldIntegratorAbstractTest.java  | 662 +++
 ...eKuttaFieldStepInterpolatorAbstractTest.java | 305 +
 .../ThreeEighthesFieldIntegratorTest.java   |   2 +-
 .../ThreeEighthesFieldStepInterpolatorTest.java |   2 +-
 28 files changed, 1847 insertions(+), 1847 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractAdamsFieldIntegratorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractAdamsFieldIntegratorTest.java
 
b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractAdamsFieldIntegratorTest.java
deleted file mode 100644
index 74a5841..000
--- 
a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractAdamsFieldIntegratorTest.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.math3.ode.nonstiff;
-
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.ode.AbstractFieldIntegrator;
-import org.apache.commons.math3.ode.FieldExpandableODE;
-import org.apache.commons.math3.ode.FieldODEState;
-import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
-import org.apache.commons.math3.ode.FirstOrderFieldIntegrator;
-import org.apache.commons.math3.ode.MultistepFieldIntegrator;
-import org.apache.commons.math3.ode.TestFieldProblem1;
-import org.apache.commons.math3.ode.TestFieldProblem5;
-import org.apache.commons.math3.ode.TestFieldProblem6;
-import org.apache.commons.math3.ode.TestFieldProblemAbstract;
-import org.apache.commons.math3.ode.TestFieldProblemHandler;

[2/4] [math] Renamed abstract test classes to match build environment filters.

2016-01-02 Thread luc
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
 
b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
deleted file mode 100644
index b5c7ff0..000
--- 
a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.math3.ode.nonstiff;
-
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.ode.AbstractIntegrator;
-import org.apache.commons.math3.ode.EquationsMapper;
-import org.apache.commons.math3.ode.ExpandableStatefulODE;
-import org.apache.commons.math3.ode.FieldEquationsMapper;
-import org.apache.commons.math3.ode.FieldExpandableODE;
-import org.apache.commons.math3.ode.FirstOrderFieldDifferentialEquations;
-import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
-import org.apache.commons.math3.ode.sampling.AbstractFieldStepInterpolator;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.junit.Assert;
-import org.junit.Test;
-
-public abstract class AbstractRungeKuttaFieldStepInterpolatorTest {
-
-protected abstract > 
RungeKuttaFieldStepInterpolator
-createInterpolator(Field field, boolean forward, T[][] yDotK,
-   FieldODEStateAndDerivative globalPreviousState,
-   FieldODEStateAndDerivative globalCurrentState,
-   FieldODEStateAndDerivative softPreviousState,
-   FieldODEStateAndDerivative softCurrentState,
-   FieldEquationsMapper mapper);
-
-protected abstract > 
FieldButcherArrayProvider
-createButcherArrayProvider(final Field field);
-
-@Test
-public abstract void interpolationAtBounds();
-
-protected > void 
doInterpolationAtBounds(final Field field, double epsilon) {
-
-RungeKuttaFieldStepInterpolator interpolator = 
setUpInterpolator(field,
-
new SinCos(field),
-
0.0, new double[] { 0.0, 1.0 }, 0.125);
-
-Assert.assertEquals(0.0, 
interpolator.getPreviousState().getTime().getReal(), 1.0e-15);
-for (int i = 0; i < 2; ++i) {
-
Assert.assertEquals(interpolator.getPreviousState().getState()[i].getReal(),
-
interpolator.getInterpolatedState(interpolator.getPreviousState().getTime()).getState()[i].getReal(),
-epsilon);
-}
-Assert.assertEquals(0.125, 
interpolator.getCurrentState().getTime().getReal(), 1.0e-15);
-for (int i = 0; i < 2; ++i) {
-
Assert.assertEquals(interpolator.getCurrentState().getState()[i].getReal(),
-
interpolator.getInterpolatedState(interpolator.getCurrentState().getTime()).getState()[i].getReal(),
-epsilon);
-}
-
-}
-
-@Test
-public abstract void interpolationInside();
-
-protected > void doInterpolationInside(final 
Field field,
- 
double epsilonSin, double epsilonCos) {
-
-RungeKuttaFieldStepInterpolator interpolator = 
setUpInterpolator(field,
-
new SinCos(field),
-
0.0, new double[] { 0.0, 1.0 }, 0.0125);
-
-int n = 100;
-double maxErrorSin = 0;
-double maxErrorCos = 0;
-for (int i = 0; i <= n; ++i) {
-T t = interpolator.getPreviousState().getTime().multiply(n - 
i).
-   

[02/14] [math] Updated released howto after change from people to home.apache.org.

2016-01-02 Thread luc
Updated released howto after change from people to home.apache.org.

Shell access is not possible anymore on home.apache.org, so the site
uplaoding must be done using sftp only.

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/445f091b
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/445f091b
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/445f091b

Branch: refs/heads/3.6-release
Commit: 445f091bcd93d76559279032865b26ffb46aa749
Parents: 77f0f20
Author: Luc Maisonobe <l...@apache.org>
Authored: Fri Jan 1 19:59:33 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Fri Jan 1 19:59:33 2016 +0100

--
 doc/release/release.howto.txt | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/445f091b/doc/release/release.howto.txt
--
diff --git a/doc/release/release.howto.txt b/doc/release/release.howto.txt
index b620e55..a667aa2 100644
--- a/doc/release/release.howto.txt
+++ b/doc/release/release.howto.txt
@@ -313,18 +313,19 @@ edit README.html with released version number
 (13)
 As the web site staging area is shared among all commons components and 
therefore
 can be published before vote ends, it is not recommended to use the standard 
staging
-area for the release candidate. So you will just archive the site and transfer 
it on
-your apache personal area for review:
+area for the release candidate. So you will just archive the transfer the site 
it on
+your apache personal area for review. Here is how to do this using lftp to 
initiate
+the sftp transfer (lftp supports a mirror command for recursive transfers, 
don't
+forget the -R flag for uploading instead of downloading the site):
 
   $ mvn site
   $ cd target
-  $ tar czf site.tar.gz site
-  $ scp site.tar.gz __your_apache_logi...@people.apache.org:~/
-  $ ssh __your_apache_logi...@people.apache.org
- you@minotaur:~$ tar xzf site.tar.gz
- you@minotaur:~$ mv site public_html/commons-math-3.4-RC1-site
- you@minotaur:~$ rm site.tar.gz
- you@minotaur:~$ logout
+  $ mv site commons-math-3.4-RC1-site
+  $ lftp sftp://__your_apache_logi...@home.apache.org/
+ lftp y...@home.apache.org:~> cd public_html
+ lftp y...@home.apache.org:~/public_html> mirror -R 
commons-math-3.4-RC1-site
+ lftp y...@home.apache.org:~/public_html> bye
+
 
 (14)
 Call to vote by sending a message to the "dev" ML with subject
@@ -343,7 +344,7 @@ Commit ID the tag points at:
   cf4a9d70c9ac24dd7196995390171150e4e56451
 
 Site:
-  <http://people.apache.org/~__Your_apache_login__/commons-math-3.4-RC1-site>
+  <http://home.apache.org/~__Your_apache_login__/commons-math-3.4-RC1-site>
 
 Distribution files:
   https://dist.apache.org/repos/dist/dev/commons/math/



[06/14] [math] Renamed abstract test classes to match build environment filters.

2016-01-02 Thread luc
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
 
b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
deleted file mode 100644
index b5c7ff0..000
--- 
a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.math3.ode.nonstiff;
-
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.ode.AbstractIntegrator;
-import org.apache.commons.math3.ode.EquationsMapper;
-import org.apache.commons.math3.ode.ExpandableStatefulODE;
-import org.apache.commons.math3.ode.FieldEquationsMapper;
-import org.apache.commons.math3.ode.FieldExpandableODE;
-import org.apache.commons.math3.ode.FirstOrderFieldDifferentialEquations;
-import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
-import org.apache.commons.math3.ode.sampling.AbstractFieldStepInterpolator;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.junit.Assert;
-import org.junit.Test;
-
-public abstract class AbstractRungeKuttaFieldStepInterpolatorTest {
-
-protected abstract > 
RungeKuttaFieldStepInterpolator
-createInterpolator(Field field, boolean forward, T[][] yDotK,
-   FieldODEStateAndDerivative globalPreviousState,
-   FieldODEStateAndDerivative globalCurrentState,
-   FieldODEStateAndDerivative softPreviousState,
-   FieldODEStateAndDerivative softCurrentState,
-   FieldEquationsMapper mapper);
-
-protected abstract > 
FieldButcherArrayProvider
-createButcherArrayProvider(final Field field);
-
-@Test
-public abstract void interpolationAtBounds();
-
-protected > void 
doInterpolationAtBounds(final Field field, double epsilon) {
-
-RungeKuttaFieldStepInterpolator interpolator = 
setUpInterpolator(field,
-
new SinCos(field),
-
0.0, new double[] { 0.0, 1.0 }, 0.125);
-
-Assert.assertEquals(0.0, 
interpolator.getPreviousState().getTime().getReal(), 1.0e-15);
-for (int i = 0; i < 2; ++i) {
-
Assert.assertEquals(interpolator.getPreviousState().getState()[i].getReal(),
-
interpolator.getInterpolatedState(interpolator.getPreviousState().getTime()).getState()[i].getReal(),
-epsilon);
-}
-Assert.assertEquals(0.125, 
interpolator.getCurrentState().getTime().getReal(), 1.0e-15);
-for (int i = 0; i < 2; ++i) {
-
Assert.assertEquals(interpolator.getCurrentState().getState()[i].getReal(),
-
interpolator.getInterpolatedState(interpolator.getCurrentState().getTime()).getState()[i].getReal(),
-epsilon);
-}
-
-}
-
-@Test
-public abstract void interpolationInside();
-
-protected > void doInterpolationInside(final 
Field field,
- 
double epsilonSin, double epsilonCos) {
-
-RungeKuttaFieldStepInterpolator interpolator = 
setUpInterpolator(field,
-
new SinCos(field),
-
0.0, new double[] { 0.0, 1.0 }, 0.0125);
-
-int n = 100;
-double maxErrorSin = 0;
-double maxErrorCos = 0;
-for (int i = 0; i <= n; ++i) {
-T t = interpolator.getPreviousState().getTime().multiply(n - 
i).
-   

[10/14] [math] Spurious @Override.

2016-01-02 Thread luc
Spurious @Override.

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/e2066886
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/e2066886
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/e2066886

Branch: refs/heads/3.6-release
Commit: e206688654f171f8757911cd904771bb6200b492
Parents: c5e6ccb
Author: Luc Maisonobe <l...@apache.org>
Authored: Sat Jan 2 19:44:30 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sat Jan 2 19:44:30 2016 +0100

--
 .../java/org/apache/commons/math3/random/BitsStreamGenerator.java   | 1 -
 1 file changed, 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/e2066886/src/main/java/org/apache/commons/math3/random/BitsStreamGenerator.java
--
diff --git 
a/src/main/java/org/apache/commons/math3/random/BitsStreamGenerator.java 
b/src/main/java/org/apache/commons/math3/random/BitsStreamGenerator.java
index 9f7cb56..7a8aef5 100644
--- a/src/main/java/org/apache/commons/math3/random/BitsStreamGenerator.java
+++ b/src/main/java/org/apache/commons/math3/random/BitsStreamGenerator.java
@@ -187,7 +187,6 @@ public abstract class BitsStreamGenerator
  *
  * @param bytes Array in which to put the generated bytes. Cannot be 
{@code null}.
  */
-@Override
 public void nextBytes(byte[] bytes) {
 nextBytesFill(bytes, 0, bytes.length);
 }



[13/14] [math] Merge branch 'MATH_3_X' into 3.6-release

2016-01-02 Thread luc
Merge branch 'MATH_3_X' into 3.6-release

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/47ae2b7c
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/47ae2b7c
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/47ae2b7c

Branch: refs/heads/3.6-release
Commit: 47ae2b7c84fba9f4dd857b7c70941ec2ef7e6f39
Parents: 2525399 026e330
Author: Luc Maisonobe <l...@apache.org>
Authored: Sat Jan 2 19:53:12 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sat Jan 2 19:53:12 2016 +0100

--
 build.xml   |  23 +-
 doc/release/release.howto.txt   |  21 +-
 .../apache/commons/math3/complex/Complex.java   | 154 ++---
 .../math3/random/BitsStreamGenerator.java   |   1 -
 .../apache/commons/math3/util/Precision.java|  39 +-
 src/site/xdoc/userguide/stat.xml|   9 +-
 .../commons/math3/complex/ComplexTest.java  |  18 +
 .../EnumeratedIntegerDistributionTest.java  |   5 +-
 .../AbstractAdamsFieldIntegratorTest.java   | 260 
 ...ctEmbeddedRungeKuttaFieldIntegratorTest.java | 600 -
 .../AbstractRungeKuttaFieldIntegratorTest.java  | 662 ---
 ...ractRungeKuttaFieldStepInterpolatorTest.java | 305 -
 .../AdamsBashforthFieldIntegratorTest.java  |   2 +-
 .../AdamsFieldIntegratorAbstractTest.java   | 260 
 .../AdamsMoultonFieldIntegratorTest.java|   2 +-
 ...sicalRungKuttaFieldStepInterpolatorTest.java |   2 +-
 .../ClassicalRungeKuttaFieldIntegratorTest.java |   2 +-
 .../DormandPrince54FieldIntegratorTest.java |   2 +-
 ...ormandPrince54FieldStepInterpolatorTest.java |   2 +-
 .../DormandPrince853FieldIntegratorTest.java|   2 +-
 ...rmandPrince853FieldStepInterpolatorTest.java |   2 +-
 ...edRungeKuttaFieldIntegratorAbstractTest.java | 600 +
 .../ode/nonstiff/EulerFieldIntegratorTest.java  |   2 +-
 .../EulerFieldStepInterpolatorTest.java |   2 +-
 .../ode/nonstiff/GillFieldIntegratorTest.java   |   2 +-
 .../nonstiff/GillFieldStepInterpolatorTest.java |   2 +-
 .../HighamHall54FieldIntegratorTest.java|   2 +-
 .../HighamHall54FieldStepInterpolatorTest.java  |   2 +-
 .../ode/nonstiff/LutherFieldIntegratorTest.java |   2 +-
 .../LutherFieldStepInterpolatorTest.java|   2 +-
 .../nonstiff/MidpointFieldIntegratorTest.java   |   2 +-
 .../MidpointFieldStepInterpolatorTest.java  |   2 +-
 .../RungeKuttaFieldIntegratorAbstractTest.java  | 662 +++
 ...eKuttaFieldStepInterpolatorAbstractTest.java | 305 +
 .../ThreeEighthesFieldIntegratorTest.java   |   2 +-
 .../ThreeEighthesFieldStepInterpolatorTest.java |   2 +-
 test-jar.xml|  50 +-
 37 files changed, 2006 insertions(+), 2008 deletions(-)
--




[01/14] [math] Updated User Guide to reflect MATH-1310 fix.

2016-01-02 Thread luc
Repository: commons-math
Updated Branches:
  refs/heads/3.6-release 2525399e1 -> 95a9d35e7


Updated User Guide to reflect MATH-1310 fix.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/77f0f202
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/77f0f202
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/77f0f202

Branch: refs/heads/3.6-release
Commit: 77f0f202524935c69621e9883eb105e7fca4ecd5
Parents: d70c566
Author: Phil Steitz 
Authored: Fri Jan 1 08:48:22 2016 -0700
Committer: Phil Steitz 
Committed: Fri Jan 1 08:48:22 2016 -0700

--
 src/site/xdoc/userguide/stat.xml | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/77f0f202/src/site/xdoc/userguide/stat.xml
--
diff --git a/src/site/xdoc/userguide/stat.xml b/src/site/xdoc/userguide/stat.xml
index b93e0e1..305795c 100644
--- a/src/site/xdoc/userguide/stat.xml
+++ b/src/site/xdoc/userguide/stat.xml
@@ -915,10 +915,9 @@ new KendallsCorrelation().correlation(x, y)
http://www.jstatsoft.org/v39/i11/;> Computing the 
Two-Sided Kolmogorov-Smirnov
Distribution by Richard Simard and Pierre L'Ecuyer.  In the 
2-sample case, estimation
by default depends on the number of data points.  For small 
samples, the distribution
-   is computed exactly; for moderately large samples a Monte Carlo 
procedure is used, and
-   for large samples a numerical approximation of the Kolmogorov 
distribution is used.
-   Methods to perform each type of p-value estimation are also exposed 
directly.  See
-   the class javadoc for details.
+   is computed exactly and for large samples a numerical approximation 
of the Kolmogorov
+   distribution is used. Methods to perform each type of p-value 
estimation are also exposed
+   directly.  See the class javadoc for details.
   
   
   
@@ -1237,7 +1236,7 @@ final double d = TestUtils.kolmogorovSmirnovStatistic(x, 
y);
 TestUtils.exactP(d, x.length, y.length, false)
   
   assuming that the non-strict form of the null hypothesis is desired. 
Note, however,
-  that exact computation for anything but very small samples takes a 
very long time.
+  that exact computation for large samples takes a long time.
   
 
 



[12/14] [math] Merge branch 'MATH_3_X' of https://l...@git-wip-us.apache.org/repos/asf/commons-math.git into MATH_3_X

2016-01-02 Thread luc
Merge branch 'MATH_3_X' of 
https://l...@git-wip-us.apache.org/repos/asf/commons-math.git into MATH_3_X

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/026e3305
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/026e3305
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/026e3305

Branch: refs/heads/3.6-release
Commit: 026e3305399dca03146da7f38c7be087395e60cb
Parents: 775bde7 68194a3
Author: Luc Maisonobe <l...@apache.org>
Authored: Sat Jan 2 19:52:22 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sat Jan 2 19:52:22 2016 +0100

--
 build.xml| 23 +--
 test-jar.xml | 50 --
 2 files changed, 33 insertions(+), 40 deletions(-)
--




[11/14] [math] Enlarged test tolerance as test did not pass with Java 5.

2016-01-02 Thread luc
Enlarged test tolerance as test did not pass with Java 5.

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/775bde7a
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/775bde7a
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/775bde7a

Branch: refs/heads/3.6-release
Commit: 775bde7a4df691bd5890475d0398a31411508f81
Parents: e206688
Author: Luc Maisonobe <l...@apache.org>
Authored: Sat Jan 2 19:46:33 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sat Jan 2 19:46:33 2016 +0100

--
 .../math3/distribution/EnumeratedIntegerDistributionTest.java   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/775bde7a/src/test/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistributionTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistributionTest.java
 
b/src/test/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistributionTest.java
index 85aa5af..4277187 100644
--- 
a/src/test/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistributionTest.java
+++ 
b/src/test/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistributionTest.java
@@ -22,6 +22,7 @@ import org.apache.commons.math3.exception.NotANumberException;
 import org.apache.commons.math3.exception.NotFiniteNumberException;
 import org.apache.commons.math3.exception.NotPositiveException;
 import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math3.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -173,7 +174,7 @@ public class EnumeratedIntegerDistributionTest {
 public void testCreateFromIntegers() {
 final int[] data = new int[] {0, 1, 1, 2, 2, 2};
 EnumeratedIntegerDistribution distribution = new 
EnumeratedIntegerDistribution(data);
-Assert.assertEquals(0.5, distribution.probability(2), 0);
-Assert.assertEquals(0.5, distribution.cumulativeProbability(1), 0);
+Assert.assertEquals(0.5, distribution.probability(2), 
Precision.EPSILON);
+Assert.assertEquals(0.5, distribution.cumulativeProbability(1), 
Precision.EPSILON);
 }
 }



[14/14] [math] Preparing release candidate 2 for Apache Commons Math 3.6.

2016-01-02 Thread luc
Preparing release candidate 2 for Apache Commons Math 3.6.

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/95a9d35e
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/95a9d35e
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/95a9d35e

Branch: refs/heads/3.6-release
Commit: 95a9d35e77f70ffc9bd5143880c236a760b42005
Parents: 47ae2b7
Author: Luc Maisonobe <l...@apache.org>
Authored: Sat Jan 2 19:56:59 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sat Jan 2 19:56:59 2016 +0100

--
 pom.xml | 2 +-
 src/changes/changes.xml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/95a9d35e/pom.xml
--
diff --git a/pom.xml b/pom.xml
index edeacf3..3705a86 100644
--- a/pom.xml
+++ b/pom.xml
@@ -376,7 +376,7 @@
 
 3.6
 (requires Java 1.5+)
-RC1
+RC2
 -bin
 
 2.2

http://git-wip-us.apache.org/repos/asf/commons-math/blob/95a9d35e/src/changes/changes.xml
--
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 90e8dc9..21ab68f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -50,7 +50,7 @@ If the output is not quite correct, check for invisible 
trailing spaces!
 Commons Math Release Notes
   
   
-

[05/14] [math] Renamed abstract test classes to match build environment filters.

2016-01-02 Thread luc
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29649959/src/test/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegratorAbstractTest.java
--
diff --git 
a/src/test/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegratorAbstractTest.java
 
b/src/test/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegratorAbstractTest.java
new file mode 100644
index 000..518690a
--- /dev/null
+++ 
b/src/test/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegratorAbstractTest.java
@@ -0,0 +1,662 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math3.ode.nonstiff;
+
+
+import java.lang.reflect.Array;
+
+import org.apache.commons.math3.Field;
+import org.apache.commons.math3.RealFieldElement;
+import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math3.exception.NoBracketingException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math3.ode.FieldExpandableODE;
+import org.apache.commons.math3.ode.FirstOrderFieldDifferentialEquations;
+import org.apache.commons.math3.ode.FieldODEState;
+import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
+import org.apache.commons.math3.ode.TestFieldProblem1;
+import org.apache.commons.math3.ode.TestFieldProblem2;
+import org.apache.commons.math3.ode.TestFieldProblem3;
+import org.apache.commons.math3.ode.TestFieldProblem4;
+import org.apache.commons.math3.ode.TestFieldProblem5;
+import org.apache.commons.math3.ode.TestFieldProblem6;
+import org.apache.commons.math3.ode.TestFieldProblemAbstract;
+import org.apache.commons.math3.ode.TestFieldProblemHandler;
+import org.apache.commons.math3.ode.events.Action;
+import org.apache.commons.math3.ode.events.FieldEventHandler;
+import org.apache.commons.math3.ode.sampling.FieldStepHandler;
+import org.apache.commons.math3.ode.sampling.FieldStepInterpolator;
+import org.apache.commons.math3.ode.sampling.StepInterpolatorTestUtils;
+import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math3.util.MathArrays;
+import org.junit.Assert;
+import org.junit.Test;
+
+public abstract class RungeKuttaFieldIntegratorAbstractTest {
+
+protected abstract > 
RungeKuttaFieldIntegrator
+createIntegrator(Field field, T step);
+
+@Test
+public abstract void testNonFieldIntegratorConsistency();
+
+protected > void 
doTestNonFieldIntegratorConsistency(final Field field) {
+try {
+
+// get the Butcher arrays from the field integrator
+RungeKuttaFieldIntegrator fieldIntegrator = 
createIntegrator(field, field.getZero().add(1));
+T[][] fieldA = fieldIntegrator.getA();
+T[]   fieldB = fieldIntegrator.getB();
+T[]   fieldC = fieldIntegrator.getC();
+
+String fieldName   = fieldIntegrator.getClass().getName();
+String regularName = fieldName.replaceAll("Field", "");
+
+// get the Butcher arrays from the regular integrator
+@SuppressWarnings("unchecked")
+Class c = (Class) 
Class.forName(regularName);
+java.lang.reflect.Field jlrFieldA = c.getDeclaredField("STATIC_A");
+jlrFieldA.setAccessible(true);
+double[][] regularA = (double[][]) jlrFieldA.get(null);
+java.lang.reflect.Field jlrFieldB = c.getDeclaredField("STATIC_B");
+jlrFieldB.setAccessible(true);
+double[]   regularB = (double[])   jlrFieldB.get(null);
+java.lang.reflect.Field jlrFieldC = c.getDeclaredField("STATIC_C");
+jlrFieldC.setAccessible(true);
+double[]   regularC = (double[])   jlrFieldC.get(null);
+
+Assert.assertEquals(regularA.length, fieldA.length);
+for (int i = 0; i < regularA.length; ++i) {
+checkArray(regularA[i], fieldA[i]);
+}
+checkArray(regularB, fieldB);
+checkArray(regularC, 

[08/14] [math] Merge branch 'MATH_3_X' of https://l...@git-wip-us.apache.org/repos/asf/commons-math.git into MATH_3_X

2016-01-02 Thread luc
Merge branch 'MATH_3_X' of 
https://l...@git-wip-us.apache.org/repos/asf/commons-math.git into MATH_3_X

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/c5e6ccb8
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/c5e6ccb8
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/c5e6ccb8

Branch: refs/heads/3.6-release
Commit: c5e6ccb81771a2ad82d4c4ff02edb73c2cd18184
Parents: 2964995 895e9c1
Author: Luc Maisonobe <l...@apache.org>
Authored: Sat Jan 2 10:28:21 2016 +0100
Committer: Luc Maisonobe <l...@apache.org>
Committed: Sat Jan 2 10:28:21 2016 +0100

--
 .../apache/commons/math3/complex/Complex.java   | 154 ---
 .../apache/commons/math3/util/Precision.java|  39 +++--
 .../commons/math3/complex/ComplexTest.java  |  18 +++
 3 files changed, 108 insertions(+), 103 deletions(-)
--




[03/14] [math] Javadoc fixes; added tests to confirm NaN behavior.

2016-01-02 Thread luc
Javadoc fixes; added tests to confirm NaN behavior.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/a5ccf599
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/a5ccf599
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/a5ccf599

Branch: refs/heads/3.6-release
Commit: a5ccf5998af87deafd822b40686de4ed75019c19
Parents: 77f0f20
Author: Phil Steitz 
Authored: Fri Jan 1 15:07:07 2016 -0700
Committer: Phil Steitz 
Committed: Fri Jan 1 15:07:07 2016 -0700

--
 .../apache/commons/math3/complex/Complex.java   | 154 ---
 .../apache/commons/math3/util/Precision.java|  39 +++--
 .../commons/math3/complex/ComplexTest.java  |  18 +++
 3 files changed, 108 insertions(+), 103 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/commons-math/blob/a5ccf599/src/main/java/org/apache/commons/math3/complex/Complex.java
--
diff --git a/src/main/java/org/apache/commons/math3/complex/Complex.java 
b/src/main/java/org/apache/commons/math3/complex/Complex.java
index c8bd211..bf43120 100644
--- a/src/main/java/org/apache/commons/math3/complex/Complex.java
+++ b/src/main/java/org/apache/commons/math3/complex/Complex.java
@@ -32,7 +32,7 @@ import org.apache.commons.math3.util.Precision;
 /**
  * Representation of a Complex number, i.e. a number which has both a
  * real and imaginary part.
- * 
+ * 
  * Implementations of arithmetic operations handle {@code NaN} and
  * infinite values according to the rules for {@link java.lang.Double}, i.e.
  * {@link #equals} is an equivalence relation for all instances that have
@@ -42,16 +42,14 @@ import org.apache.commons.math3.util.Precision;
  *  {@code 1 + NaNi}
  *  {@code NaN + i}
  *  {@code NaN + NaNi}
- * 
- * Note that this is in contradiction with the IEEE-754 standard for floating
+ * 
+ * Note that this contradicts the IEEE-754 standard for floating
  * point numbers (according to which the test {@code x == x} must fail if
  * {@code x} is {@code NaN}). The method
  * {@link org.apache.commons.math3.util.Precision#equals(double,double,int)
  * equals for primitive double} in {@link 
org.apache.commons.math3.util.Precision}
  * conforms with IEEE-754 while this class conforms with the standard behavior
- * for Java object types.
- * 
- * Implements Serializable since 2.0
+ * for Java object types.
  *
  */
 public class Complex implements FieldElement, Serializable  {
@@ -138,12 +136,9 @@ public class Complex implements FieldElement, 
Serializable  {
  * Returns a {@code Complex} whose value is
  * {@code (this + addend)}.
  * Uses the definitional formula
- * 
- *  
- *   (a + bi) + (c + di) = (a+c) + (b+d)i
- *  
- * 
- * 
+ * 
+ *   {@code (a + bi) + (c + di) = (a+c) + (b+d)i}
+ * 
  * If either {@code this} or {@code addend} has a {@code NaN} value in
  * either part, {@link #NaN} is returned; otherwise {@code Infinite}
  * and {@code NaN} values are returned in the parts of the result
@@ -180,17 +175,17 @@ public class Complex implements FieldElement, 
Serializable  {
 }
 
  /**
- * Return the conjugate of this complex number.
+ * Returns the conjugate of this complex number.
  * The conjugate of {@code a + bi} is {@code a - bi}.
- * 
+ * 
  * {@link #NaN} is returned if either the real or imaginary
  * part of this Complex number equals {@code Double.NaN}.
- * 
+ * 
  * If the imaginary part is infinite, and the real part is not
  * {@code NaN}, the returned value has infinite imaginary part
  * of the opposite sign, e.g. the conjugate of
  * {@code 1 + POSITIVE_INFINITY i} is {@code 1 - NEGATIVE_INFINITY i}.
- *
+ * 
  * @return the conjugate of this Complex object.
  */
 public Complex conjugate() {
@@ -216,7 +211,7 @@ public class Complex implements FieldElement, 
Serializable  {
  * http://doi.acm.org/10.1145/1039813.1039814;>
  * prescaling of operands to limit the effects of overflows and
  * underflows in the computation.
- * 
+ * 
  * {@code Infinite} and {@code NaN} values are handled according to the
  * following rules, applied in the order presented:
  * 
@@ -401,7 +396,7 @@ public class Complex implements FieldElement, 
Serializable  {
  * Returns {@code true} if, both for the real part and for the imaginary
  * part, there is no double value strictly between the arguments or the
  * difference between them is within the range of allowed error
- * (inclusive).
+ * (inclusive).  Returns {@code false} if either of the arguments is NaN.
  *
  * @param x First value (cannot be {@code null}).
 

[04/14] [math] Merge branch 'MATH_3_X' of https://git-wip-us.apache.org/repos/asf/commons-math into MATH_3_X

2016-01-02 Thread luc
Merge branch 'MATH_3_X' of https://git-wip-us.apache.org/repos/asf/commons-math 
into MATH_3_X


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/895e9c1c
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/895e9c1c
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/895e9c1c

Branch: refs/heads/3.6-release
Commit: 895e9c1c506a7474536050989844ef5871636ebb
Parents: a5ccf59 445f091
Author: Phil Steitz 
Authored: Fri Jan 1 15:07:30 2016 -0700
Committer: Phil Steitz 
Committed: Fri Jan 1 15:07:30 2016 -0700

--
 doc/release/release.howto.txt | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)
--




svn commit: r11794 - in /dev/commons/math: binaries/ source/

2016-01-02 Thread luc
Author: luc
Date: Sat Jan  2 20:12:27 2016
New Revision: 11794

Log:
Creating distribution files for 3.6 RC2.

Modified:
dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz
dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz.asc
dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz.md5
dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz.sha1
dev/commons/math/binaries/commons-math3-3.6-bin.zip
dev/commons/math/binaries/commons-math3-3.6-bin.zip.asc
dev/commons/math/binaries/commons-math3-3.6-bin.zip.md5
dev/commons/math/binaries/commons-math3-3.6-bin.zip.sha1
dev/commons/math/source/commons-math3-3.6-src.tar.gz
dev/commons/math/source/commons-math3-3.6-src.tar.gz.asc
dev/commons/math/source/commons-math3-3.6-src.tar.gz.md5
dev/commons/math/source/commons-math3-3.6-src.tar.gz.sha1
dev/commons/math/source/commons-math3-3.6-src.zip
dev/commons/math/source/commons-math3-3.6-src.zip.asc
dev/commons/math/source/commons-math3-3.6-src.zip.md5
dev/commons/math/source/commons-math3-3.6-src.zip.sha1

Modified: dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz
==
Binary files - no diff available.

Modified: dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz.asc
==
--- dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz.asc (original)
+++ dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz.asc Sat Jan  2 
20:12:27 2016
@@ -1,17 +1,17 @@
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1
 
-iQIcBAABCgAGBQJWho+/AAoJEJrilv0C6fZbKAMP/jdXjU7BPflg+DK+OeSXzhOI
-iVLpnSRvGN71S7HFlcOLK4HszEYZOmEVKDv4XF7kSQJy4cUqczXbJIt5cgcC/zLz
-+Lw0CsAZV0z40coxNHO244jppkwxu3EmptmddXByRbRp2i7wcRwDcTPxIsn5sCQp
-ak0DtsHFkPCpSITTN/z7F9A2rdoNEuAX4gL3tlSAiAKIH+e00TL0aidxWY1cHPcV
-GYPOHDCDekpnSWIA8Z3/Ye0Yc1BkroVWguE1vj4rMVMe+d6trR0SprfnsgAZb2q6
-G1LgI1siGqjORUWzOcqCSFUQgBNwds+G76NWlCVdlmGun/QwF2REyBrtkYpsIGVy
-Pxuyrb5Ys+oaS/ri3RoqGlkxmCQNbm0/oGjkTsItlTAPTARFSO7eUS/byv5uMJ8K
-6q/i29vMk9RIXX4JFaomBQ0lSZqwIKyQCXEoI2XDfXhCWo9/g3Szproizw8/AUR+
-Sc4ta0g9tJUquDszk0f0olKnN14LprnH490zymQHdzVStj4zgRQjaTPOe+DAUi23
-bSUm5bV3irf3N412rzw7BHJXYc/Zxt0cm+6HnVSjW1EcXWn0LyoWpKTolRqjI0R4
-2Zq12k82gOvW+mZ6MdxO912euc51sKi2DZ853DiOaZUQ6SY/kOyKV2+twHwOf5Rn
-4+/umpOeZEQDQk5b1ypk
-=wYBt
+iQIcBAABCgAGBQJWiCasAAoJEJrilv0C6fZbQP0P/01TG5nc0iOswBtlh6OvTSKt
+MGXVGks4pLzusDvrWN8zdhAiNBx41ocJhy1zDF0Et+SMQIqIx9OAwE19s3AMQKph
+IRkuR5QtTfa4OTNF5lkXNVJB/LS32JQNAnRRtHqA44W1vd3YtTGQtLQuADgKpUwF
+z4LqKb19LcOkHcj5QOm0py/61MQF4oO2xZHWOh4sfYpcIYb8qY9Jwgcyn8ImDbxU
+Qoos8+cK+x8ZyvIhrkSkG2BtY5VzS5TLfQjEeGYyp91XgKxVsFeaIfx/y81wfz5+
+fMixEPDgICgmRlsT4UhVpVNYb65UnhqnwFnCzb1hL/PSjCIQ+aAiV2+q4WAP0h2W
+hRx3Y6ZMnoxQgK1RsciQy/OiinFp7qAReRmZ8zbb88HqSD205xloK2NmoqgmAKrB
+fXm5S7Gdx1KeSh2CwLnVrQKEpeOwIgyx0d2u/Yds/Lrd6AMj228StTYHLrExS4Hx
+q5L1JQf09A4QF49Csd42uzxApBWXGeKLQ33Mb9ZnN5RuxInVBk3rLbPwxcc8lApU
+HgKWjnYy869B2Y4fHTg5MD4EzirGghp5Jd/AzD+KS0TE2o4ZVP2zeTpgStyw2ZYf
+/e4yFkzFg8l0PirZVzIKXtPC2hAfXcPt8eZh75u0ZGUCugstZ5quNze1cutE1ddv
+DtahKnqVvtfmrPtGsBae
+=aE/s
 -END PGP SIGNATURE-

Modified: dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz.md5
==
--- dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz.md5 (original)
+++ dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz.md5 Sat Jan  2 
20:12:27 2016
@@ -1 +1 @@
-e2ac275d41cebc5318e2b92b4661e117
\ No newline at end of file
+1a85a08fca3438e808852b64944e7d0e
\ No newline at end of file

Modified: dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz.sha1
==
--- dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz.sha1 (original)
+++ dev/commons/math/binaries/commons-math3-3.6-bin.tar.gz.sha1 Sat Jan  2 
20:12:27 2016
@@ -1 +1 @@
-a41da1d7e9368132c7273c13ca760b6abaf0d3f6
\ No newline at end of file
+8b0b724b91102f63c7211f8de60dec19f94c4af7
\ No newline at end of file

Modified: dev/commons/math/binaries/commons-math3-3.6-bin.zip
==
Binary files - no diff available.

Modified: dev/commons/math/binaries/commons-math3-3.6-bin.zip.asc
==
--- dev/commons/math/binaries/commons-math3-3.6-bin.zip.asc (original)
+++ dev/commons/math/binaries/commons-math3-3.6-bin.zip.asc Sat Jan  2 20:12:27 
2016
@@ -1,17 +1,17 @@
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1
 
-iQIcBAABCgAGBQJWho/AAAoJEJrilv0C6fZbcVgP/1foPTWfFH8+4i3eRGe5vaxi
-80nbO2NShYXJd7hQG4sVY3sg1msZXHW3aRox8NV+5LCVGm5+9b/c26piuTeh2Rcj
-E2iC3F71CXQq/56eiZvfq8uvq16WgZICzK9ejploAFeqHVBQe/l9vQ0un0F/NZbY
-7hmcFU8krp0JhAwZHMRENCzDWPsOnJO3fekWtVZA6mh+ybHryzdK1QZ859AvV16S
-iQvOMWvOR58ESZWe53mXRaErpYQmiqn6dBA+W9jqRDgfyVkyk6KJ/j3Tiwig1tBk
-ApqJIkw

  1   2   3   4   5   6   7   8   9   10   >